A list of available events that you can use to extend Vvveb.

Components

All components have at least an event trigger in results method

list($results) = Event :: trigger(__CLASS__,__FUNCTION__, $results);

You can attach to a component results event to filter the content using

// filter comments and add gravatars for users that don't have an avatar,  __CLASS__ is usually used instead of 'Vvveb\Plugins\GravatarPlugin' for convenience.
Event::on('Vvveb\Component\Comments', 'results', 'Vvveb\Plugins\GravatarPlugin' , function ($comments) {
    foreach ($comments['comments'] as &$comment) {
        $comment['avatar'] = 'https://www.gravatar.com/avatar/' . md5(strtolower($comment['email']));
    }

    return [$comments];
});

View components list

Admin

Admin menu

To add a new menu item in the admin dashboard menu you need to attach to the init-menu' event in theVvveb\Controller\Base` namespace.

// add a new entry in the admin dashboard menu, used by plugins to add a link to plugin settings
Event::on('Vvveb\Controller\Base', 'init-menu', __CLASS__, function ($menu) use ($admin_path) {
    $menu['plugins']['items']['insert-scripts'] = [
        'name'     => __('Insert scripts'),
        'url'      => $admin_path . '?module=plugins/insert-scripts/settings',
        //'icon-img' => PUBLIC_PATH . 'plugins/insert-scripts/insert-scripts.svg',
        'icon'        => 'icon-storefront-outline',
    ];

    return [$menu];
});

Core

View

Vvveb\System\Core\View

  • compile - paramters: $this->template, $this->tplFile, $this->templateEngine, $this - perform an action when a template is compiled like adding a the template for your plugin
  • render - parameters: $this->template, $filename, $this->tplFile, $this->templateEngine, $this - perform an action before the template is rendered like pushing new data to the view

Images

Vvveb\System\Images

  • publicPath - paramters: $publicPath, $type, $image, $size - use this filter to alter the public path or other parameters of an image before is resized
  • image - paramters: $image, $type, $size - use this filter to alter the path or other parameters of an image after is resized

Extensions

Vvveb\System\Extensions\Extensions

  • install - parameters: $extensionZipFile, $success - when a plugin or theme is installed

Themes

Vvveb\System\Extensions\Themes

  • install - parameters: $extensionZipFile, $success - when a theme is installed

Plugins

Vvveb\System\Extensions\Plugins

  • setup - paramters: $pluginName, $site_id - first plugin activation, use this event to create tables or other first time run of your plugin
  • activate - paramters: $pluginName, $site_id - when a plugin is activated
  • deactivate - paramters: $pluginName, $site_id - when a plugin is deactivated
  • uninstall - paramters: $pluginName, $success - when a plugin is uninstalled/removed

Controllers

Feed

Vvveb\Controller\Feed

  • index - paramters: $results - after feed data is processed

Post

Vvveb\Controller\Post

  • index - paramters: $content, $language, $slug - before post data is processed on post page

Product

Vvveb\Controller\Product

  • index - paramters: $content, $language, $slug - before product data is processed on product page

User Login

Vvveb\Controller\User\Login

  • login - paramters: $userInfo - before a user login data is checked, use it to cancel user login by returning false or add additional info or run an action.

User Signup

Vvveb\Controller\User\Signup

  • addUser - paramters: $userInfo - before a user is created, use it to cancel user creation by returning false or add additional info or run an action.

User Reset

Vvveb\Controller\User\Reset

  • index - paramters: $loginData - before a password reset is checked for the email use it to cancel password reset by returning false or add additional info or run an action.