This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

gilloub5404
gilloub5404

Hi, I tried to create a widget to my plugins, when I try to init from a controller i says my Widget class is missing. Do you I have to register the widget in the plugin class ? Widget class : <?php namespace Dotify\EventRegistration

use Backend\Classes\WidgetBase; use Dotify\EventRegistration\Models\Registration;

class Statsw extends WidgetBase { public $defaultAlias = 'registration_stats';

public function widgetDetails()
{
    return [
        'name'        => 'Registrations stats',
        'description' => 'Use to display registration statics'
    ];
}

public function render()
{
    $this->vars["stats"] = array(
        "coming"=>Registration::coming()->count(),
        "notComing"=>Registration::notComing()->count(),
        "all"=>Registration::all()->count(),
        "partner"=>Registration::isPartner()->count(),
        "invited"=>Registration::isInvited()->count(),

    );

    return $this->makePartial('statsw');
}

}

Controller constructor method

public function construct(){ parent::construct();

  BackendMenu::setContext('Dotify.EventRegistration', 'registration');

  $statWidget = new Statsw();
  $statWidget->alias = "eventRegStat";
  $statWidget->bindToController();

}

Cheers

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.