You are here

protected static function InsertUtility::getSourceWidgets in Insert 8.2

Parameters

string|array (optional) $insertTypes:

Return value

string[]

1 call to InsertUtility::getSourceWidgets()
InsertUtility::isSourceWidget in src/Utility/InsertUtility.php

File

src/Utility/InsertUtility.php, line 28

Class

InsertUtility

Namespace

Drupal\insert\Utility

Code

protected static function getSourceWidgets($insertTypes = NULL) {
  if (is_string($insertTypes)) {
    $insertTypes = [
      $insertTypes,
    ];
  }
  $sources = \Drupal::moduleHandler()
    ->invokeAll('insert_widgets');
  $widgets = [];
  foreach ($sources as $insertType => $widgetIds) {
    if (count($widgetIds) > 0 && ($insertTypes === NULL || in_array($insertType, $insertTypes))) {
      $widgets = array_merge($widgets, $widgetIds);
    }
  }
  return $widgets;
}