Gets the applicable conversion plugins.
Loop over the plugin definitions, check the applicability of each one of them and return the array of the applicable plugins.
\Drupal\paragraphs\ParagraphInterface $paragraph: The paragraph.
array $allowed_types: (optional) The parent fields allowed paragraph types.
array The applicable conversion plugins.
public function getApplicableDefinitions(ParagraphInterface $paragraph, array $allowed_types = NULL) {
$definitions = $this
->getDefinitions();
$applicable_plugins = [];
foreach ($definitions as $key => $definition) {
/** @var \Drupal\paragraphs\ParagraphsConversionInterface $plugin */
$plugin = $this
->createInstance($key);
if ($plugin && $this
->isApplicable($plugin, $paragraph, $allowed_types)) {
$applicable_plugins[$key] = $definition;
}
}
return $applicable_plugins;
}