Plugin example

return $this;
    }

    /** * Executes the listener on the plugin with the given Enlight_Event_EventArgs. * * @throws Enlight_Exception */
    public function execute(Enlight_Event_EventArgs $args)
    {
        $plugin = $this->Plugin();
        if ($plugin === null || !method_exists($plugin$this->listener)) {
            $name = $this->plugin instanceof Enlight_Plugin_Bootstrap ? $this->plugin->getName() : $this->plugin;
            trigger_error('Listener "' . $this->listener . '" in "' . $name . '" is not callable.', E_USER_ERROR);

            // throw new Enlight_Exception('Listener "' . $this->listener . '" in "' . $name . '" is not callable.');             return;
        }

        return $this->Plugin()->{$this->listener}($args);
    }

    

    public function createMenuItem(array $options)
    {
        if (!isset($options['label'])) {
            return null;
        }

        $item = new Menu();
        $item->fromArray($options);
        $plugin = $this->Plugin();
        $plugin->getMenuItems()->add($item);
        $item->setPlugin($plugin);

        return $item;
    }

    /** * @return ModelRepository<Payment> */
    final public function Payments(): ModelRepository
    {
        

  public function testGet() {
    // Assert all values are accepted through constructor and default value is     // used for non existent but defined property.     $plugin = new PluginStub([
      1 => 'oak',
      'foo' => 'bar',
      'biz' => [
        'baz' => 'boom',
      ],
      'nestedAnnotation' => new Plugin([
        'foo' => 'bar',
      ]),
    ]);
    $this->assertEquals([
      // This property wasn't in our definition but is defined as a property on       // our plugin class.       'defaultProperty' => 'testvalue',
      1 => 'oak',
      'foo' => 'bar',
      'biz' => [
        'baz' => 'boom',
      ],
new Enlight_Event_Handler_Default(
                'Enlight_Controller_Action_PostDispatch',
                [$this, 'onPostDispatch'],
                // Must be positioned before ViewRender Plugin so the ESI renderer can be registered before the template is rendered                 399
            )
        );
    }

    public function renderEsiTag(Enlight_Controller_Request_RequestHttp $request, array $params): ?string
    {
        if (!$this->Plugin()->getActive()) {
            return null;
        }

        if ($this->request === null) {
            return null;
        }

        if (!$this->get('shop')->get('esi')) {
            return null;
        }

        
Home | Imprint | This part of the site doesn't use cookies.