getPluginCollection()->get($this->plugin); } /** * Encapsulates the creation of the farm_quick's plugin collection. * * @return \Drupal\Component\Plugin\LazyPluginCollection * The block's plugin collection. */ protected function getPluginCollection() { if (!$this->pluginCollection) { $this->pluginCollection = new QuickFormPluginCollection(\Drupal::service('plugin.manager.quick_form'), $this->plugin, $this->get('settings'), $this->id()); } return $this->pluginCollection; } /** * {@inheritdoc} */ public function getPluginCollections() { return [ 'settings' => $this->getPluginCollection(), ]; } /** * {@inheritdoc} */ public function getPluginId() { return $this->plugin; } /** * {@inheritdoc} */ public function getLabel() { return $this->label; } /** * {@inheritdoc} */ public function getDescription() { return $this->description; } /** * {@inheritdoc} */ public function getHelpText() { return $this->helpText; } /** * {@inheritdoc} */ public function getSettings() { return $this->settings; } /** * {@inheritdoc} */ public static function preCreate(EntityStorageInterface $storage, array &$values) { parent::preCreate($storage, $values); /** @var \Drupal\farm_quick\QuickFormPluginManager $quick_form_plugin_manager */ $quick_form_plugin_manager = \Drupal::service('plugin.manager.quick_form'); // If the plugin is set use the default label, description and helpText. if (isset($values['plugin']) && $plugin = $quick_form_plugin_manager->getDefinition($values['plugin'], FALSE)) { foreach (['label', 'description', 'helpText'] as $field) { if (!isset($values[$field])) { $values[$field] = $plugin[$field]; } } } } /** * {@inheritdoc} */ public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); \Drupal::service('router.builder')->setRebuildNeeded(); } /** * {@inheritdoc} */ public static function postDelete(EntityStorageInterface $storage, array $entities) { parent::postDelete($storage, $entities); \Drupal::service('router.builder')->setRebuildNeeded(); } }