You are here

public function ParagraphsBehaviorManager::getApplicableDefinitions in Paragraphs 8

Gets the applicable behavior plugins.

Loop over the plugin definitions, check the applicability of each one of them and return the array of the applicable plugins.

Return value

array The applicable behavior plugins.

File

src/ParagraphsBehaviorManager.php, line 51

Class

ParagraphsBehaviorManager
Plugin type manager for paragraphs type behavior plugins.

Namespace

Drupal\paragraphs

Code

public function getApplicableDefinitions($paragraphs_type) {
  $definitions = $this
    ->getDefinitions();
  $applicable_plugins = [];
  foreach ($definitions as $key => $definition) {
    if ($definition['class']::isApplicable($paragraphs_type)) {
      $applicable_plugins[$key] = $definition;
    }
  }
  return $applicable_plugins;
}