use Drupal\Core\Form\FormStateInterface;
use Drupal\metatag\MetatagManagerInterface;
use Drupal\metatag_views\MetatagViewsValuesCleanerTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\metatag\MetatagManagerInterface;
use Drupal\metatag_views\MetatagViewsValuesCleanerTrait;
public function __construct(MetatagManagerInterface $metatag_manager, EntityTypeManagerInterface $entity_manager) {
$this->metatagManager = $metatag_manager;
$this->viewsManager = $entity_manager->getStorage('view');
}
public function __construct(MetatagManagerInterface $metatag_manager, EntityTypeManagerInterface $entity_manager) {
$this->metatagManager = $metatag_manager;
$this->viewsManager = $entity_manager->getStorage('view');
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('metatag.manager'),
public static function create(ContainerInterface $container) {
return new static(
$container->get('metatag.manager'),
$metatags = [];
if ($view_id && $display_id) {
$metatags = metatag_get_view_tags($view_id, $display_id);
}
$form['metatags'] = $this->metatagManager->form($metatags, $form, ['view']);
$metatags = [];
if ($view_id && $display_id) {
$metatags = metatag_get_view_tags($view_id, $display_id);
}
$form['metatags'] = $this->metatagManager->form($metatags, $form, ['view']);
- // 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.
* {@inheritdoc}
*/
public function form(array $values, array $element, array $token_types = [], array $included_groups = NULL, array $included_tags = NULL) {
* {@inheritdoc}
*/
public function form(array $values, array $element, array $token_types = [], array $included_groups = NULL, array $included_tags = NULL) {
$config_name = $view->getConfigDependencyName();
$config_path = 'display.' . $display_id . '.display_options.display_extenders.metatag_display_extender.metatags';
$config_name = $view->getConfigDependencyName();
$config_path = 'display.' . $display_id . '.display_options.display_extenders.metatag_display_extender.metatags';
$configuration = $this->configFactory()->getEditable($config_name);
if (empty($this->removeEmptyTags($metatags))) {
$configuration->clear($config_path);
$configuration = $this->configFactory()->getEditable($config_name);
if (empty($this->removeEmptyTags($metatags))) {
$configuration->clear($config_path);