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

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

Parameters

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

Return value

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

File

src/ViewsSlideshowWidgetPluginManager.php, line 40

Class

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;
}