class ParagraphsBehaviorManager

Plugin type manager for paragraphs type behavior plugins.


Expanded class hierarchy of ParagraphsBehaviorManager

1 file declares its use of ParagraphsBehaviorManager
1 string reference to 'ParagraphsBehaviorManager' in paragraphs/


paragraphs/src/ParagraphsBehaviorManager.php, line 14


View source
class ParagraphsBehaviorManager extends DefaultPluginManager {

   * Constructs a ParagraphsBehaviorManager object.
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct('Plugin/paragraphs/Behavior', $namespaces, $module_handler, 'Drupal\\paragraphs\\ParagraphsBehaviorInterface', 'Drupal\\paragraphs\\Annotation\\ParagraphsBehavior');
      ->setCacheBackend($cache_backend, 'paragraphs_behavior_plugins');

   * {@inheritdoc}
  public function getDefinitions() {
    $definitions = parent::getDefinitions();
    uasort($definitions, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
    return $definitions;

   * 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 array
   *   The applicable behavior plugins.
  public function getApplicableDefinitions($paragraphs_type) {
    $definitions = $this
    $applicable_plugins = [];
    foreach ($definitions as $key => $definition) {
      if ($definition['class']::isApplicable($paragraphs_type)) {
        $applicable_plugins[$key] = $definition;
    return $applicable_plugins;



Name Modifierssort descending Type Description Overrides
ParagraphsBehaviorManager::__construct public function Constructs a ParagraphsBehaviorManager object.
ParagraphsBehaviorManager::getDefinitions public function
ParagraphsBehaviorManager::getApplicableDefinitions public function Gets the applicable behavior plugins.