behaviorCollection)) { $this->behaviorCollection = new ParagraphsBehaviorCollection(\Drupal::service('plugin.manager.paragraphs.behavior'), $this->behavior_plugins); } return $this->behaviorCollection; } /** * {@inheritdoc} */ public function getBehaviorPlugin($instance_id) { return $this->getBehaviorPlugins()->get($instance_id); } /** * {@inheritdoc} */ public function getEnabledBehaviorPlugins() { return $this->getBehaviorPlugins()->getEnabled(); } /** * {@inheritdoc} */ public function getPluginCollections() { return ['behavior_plugins' => $this->getBehaviorPlugins()]; } /** * {@inheritdoc} */ public function hasEnabledBehaviorPlugin($plugin_id) { $plugins = $this->getBehaviorPlugins(); if ($plugins->has($plugin_id)) { /** @var ParagraphsBehaviorInterface $plugin */ $plugin = $plugins->get($plugin_id); $config = $plugin->getConfiguration(); return (array_key_exists('enabled', $config) && $config['enabled'] === TRUE); } return FALSE; } }