getWidgets example

$db = $this->Application()->Container()->get('db');

        $resourceId = $db->fetchOne(
            "SELECT id FROM s_core_acl_resources WHERE name = 'widgets'"
        );

        if (!$resourceId) {
            return $result;
        }

        foreach ($plugin->getWidgets() as $widget) {
            $name = $widget->getName();
            $db->insert('s_core_acl_privileges', [
                'name' => $name,
                'resourceID' => $resourceId,
            ]);
        }

        return $result;
    }

    /** * Registers a plugin in the collection. * If $removeData is set to false the plugin data will not be removed. * * @param bool $removeData * * @throws Exception * * @return bool|array */
/** * Creates a new widget * * @param string $name */
    public function createWidget($name)
    {
        $widget = new Widget();
        $widget->setName($name);
        $widget->setPlugin($this->Plugin());

        $this->Plugin()->getWidgets()->add($widget);
    }

    /** * {@inheritdoc} */
    public function subscribeEvent($event$listener = null, $position = null)
    {
        if ($listener === null && $event instanceof Enlight_Event_Handler) {
            $this->Collection()->Subscriber()->registerListener($event);
        } else {
            parent::subscribeEvent($event$listener$position);
        }
Home | Imprint | This part of the site doesn't use cookies.