Same name in other branches
  1. 5.0.x src/ViewsSlideshowWidgetPluginManager.php \Drupal\views_slideshow\ViewsSlideshowWidgetPluginManager::getDefinitions()

Gets the definition of all or filtered plugins for this type.

Paramètres

mixed $type: A string or an array of types to filter on.

Return value

mixed An array of plugin definitions. Keys are plugin IDs.

Fichier

src/ViewsSlideshowWidgetPluginManager.php, line 40

Classe

ViewsSlideshowWidgetPluginManager
Manager for Views Slideshow Widget plugins.

Namespace

Drupal\views_slideshow

Code

public function getDefinitions($type = NULL) {
    $definitions = parent::getDefinitions();
    // Filter widgets to keep only required types.
    if (!empty($type)) {
        foreach ($definitions as $widgetId => $widgetInfo) {
            if (is_array($type) && !in_array($widgetInfo['type'], $type) || is_string($type) && $widgetInfo['type'] !== $type) {
                unset($definitions[$widgetId]);
            }
        }
    }
    return $definitions;
}