X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FEntity%2FParagraphsType.php;fp=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FEntity%2FParagraphsType.php;h=f00f5a32ef77a718185cd1469b3feaf4e2d43c5d;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/paragraphs/src/Entity/ParagraphsType.php b/web/modules/contrib/paragraphs/src/Entity/ParagraphsType.php new file mode 100644 index 000000000..f00f5a32e --- /dev/null +++ b/web/modules/contrib/paragraphs/src/Entity/ParagraphsType.php @@ -0,0 +1,120 @@ +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; + } + +}