You are here

public function ViewsSlideshowWidgetPluginManager::getDefinitions in Views Slideshow 8.4

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.

Overrides DefaultPluginManager::getDefinitions

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