X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fmetatag%2Fmetatag_views%2Fsrc%2FForm%2FMetatagViewsEditForm.php;h=0e395e8426cb850b8b1f418b000f2161a18d4053;hb=059867c3f96750652c80f39e44c442a58c2549ee;hp=4398c235a5dc83d702d023b7aeca649477a13a26;hpb=eba34333e3c89f208d2f72fa91351ad019a71583;p=yaffs-website diff --git a/web/modules/contrib/metatag/metatag_views/src/Form/MetatagViewsEditForm.php b/web/modules/contrib/metatag/metatag_views/src/Form/MetatagViewsEditForm.php index 4398c235a..0e395e842 100644 --- a/web/modules/contrib/metatag/metatag_views/src/Form/MetatagViewsEditForm.php +++ b/web/modules/contrib/metatag/metatag_views/src/Form/MetatagViewsEditForm.php @@ -7,7 +7,6 @@ use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\metatag\MetatagManagerInterface; use Drupal\metatag_views\MetatagViewsValuesCleanerTrait; -use Drupal\views\ViewEntityInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -27,29 +26,37 @@ class MetatagViewsEditForm extends FormBase { protected $metatagManager; /** + * The Views manager. + * * @var \Drupal\Core\Entity\EntityStorageInterface */ protected $viewsManager; /** - * Array of display settings as returned from getDisplay of ViewEntityInterface + * Array of display settings from ViewEntityInterface::getDisplay(). * - * @var array + * @var array */ protected $display; /** - * View entity object + * View entity object. * - * @var ViewEntityInterface + * @var \Drupal\views\ViewEntityInterface */ protected $view; + /** + * {@inheritdoc} + */ public function __construct(MetatagManagerInterface $metatag_manager, EntityTypeManagerInterface $entity_manager) { $this->metatagManager = $metatag_manager; $this->viewsManager = $entity_manager->getStorage('view'); } + /** + * {@inheritdoc} + */ public static function create(ContainerInterface $container) { return new static( $container->get('metatag.manager'), @@ -72,18 +79,18 @@ class MetatagViewsEditForm extends FormBase { $view_id = \Drupal::request()->get('view_id'); $display_id = \Drupal::request()->get('display_id'); - // Get metatags from the view entity. + // Get meta tags from the view entity. $metatags = []; if ($view_id && $display_id) { $metatags = metatag_get_view_tags($view_id, $display_id); } $form['metatags'] = $this->metatagManager->form($metatags, $form, ['view']); - $form['metatags']['#title'] = t('Metatags'); + $form['metatags']['#title'] = $this->t('Metatags'); $form['metatags']['#type'] = 'fieldset'; - // Need to create that AFTER the $form['metatags'] as the whole form - // is passed to the $metatagManager->form() which causes duplicated field. + // Need to create that AFTER the $form['metatags'] as the whole form is + // passed to the $metatagManager->form() which causes duplicated field. $form['view'] = [ '#type' => 'value', '#title' => $this->t('View'), @@ -92,10 +99,10 @@ class MetatagViewsEditForm extends FormBase { '#required' => TRUE, ]; - $form['submit'] = array( + $form['actions']['submit'] = [ '#type' => 'submit', - '#value' => t('Submit'), - ); + '#value' => $this->t('Submit'), + ]; return $form; } @@ -104,7 +111,6 @@ class MetatagViewsEditForm extends FormBase { * {@inheritdoc} */ public function form(array $values, array $element, array $token_types = [], array $included_groups = NULL, array $included_tags = NULL) { - // Add the outer fieldset. $element += [ '#type' => 'details', @@ -158,15 +164,15 @@ class MetatagViewsEditForm extends FormBase { unset($metatags['view']); $metatags = $this->clearMetatagViewsDisallowedValues($metatags); - /** @var ViewEntityInterface $view */ + /** @var \Drupal\views\ViewEntityInterface $view */ $view = $this->viewsManager->load($view_id); - // Store the metatags on the view. + // Store the meta tags on the view. $config_name = $view->getConfigDependencyName(); $config_path = 'display.' . $display_id . '.display_options.display_extenders.metatag_display_extender.metatags'; - // Set configuration values based on form submission. - // This always edits the original language. + // Set configuration values based on form submission. This always edits the + // original language. $configuration = $this->configFactory()->getEditable($config_name); if (empty($this->removeEmptyTags($metatags))) { $configuration->clear($config_path);