You are here

class CustomMetaTagProperty in Custom Meta 2.0.x

Custom configured meta tags will be available.

The meta tag's values will be based upon this annotation.

Plugin annotation


@MetatagTag(
  id = "custom_meta_tag_property",
  deriver = "Drupal\custom_meta\Plugin\Derivative\CustomMetaDeriverProperty",
  label = @Translation("Custom property Meta tag"),
  description = @Translation("This plugin will be cloned from these settings for each custom tag."),
  name = "custom_meta_tag_property",
  weight = 2,
  group = "custom_meta",
  type = "string",
  secure = FALSE,
  multiple = TRUE
)

Hierarchy

  • class \Drupal\custom_meta\Plugin\metatag\Tag\CustomMetaTagProperty extends \Drupal\metatag\Plugin\metatag\Tag\MetaPropertyBase

Expanded class hierarchy of CustomMetaTagProperty

File

src/Plugin/metatag/Tag/CustomMetaTagProperty.php, line 25

Namespace

Drupal\custom_meta\Plugin\metatag\Tag
View source
class CustomMetaTagProperty extends MetaPropertyBase {

  /**
   * {@inheritdoc}
   */
  public function output() {
    $element = parent::output();

    // Unset empty values.
    if (!empty($element)) {
      foreach ($element as $key => $item) {
        if ($item['#attributes'] && empty($item['#attributes']['content'])) {
          unset($element[$key]);
        }
      }
    }
    return $element;
  }

}

Members