You are here

protected function SchemaNameBase::processItem in Schema.org Metatag 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/metatag/Tag/SchemaNameBase.php \Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase::processItem()
1 call to SchemaNameBase::processItem()
SchemaNameBase::output in src/Plugin/metatag/Tag/SchemaNameBase.php
Generate the HTML tag output for a meta tag.

File

src/Plugin/metatag/Tag/SchemaNameBase.php, line 162

Class

SchemaNameBase
All Schema.org tags should extend this class.

Namespace

Drupal\schema_metatag\Plugin\metatag\Tag

Code

protected function processItem(&$value, $key = 0) {
  $explode = $key === 0 ? $this
    ->multiple() : !in_array($key, $this
    ->neverExplode());

  // Parse out the image URL, if needed.
  $value = $this
    ->parseImageUrlValue($value, $explode);
  $value = trim($value);

  // If tag must be secure, convert all http:// to https://.
  if ($this
    ->secure() && strpos($value, 'http://') !== FALSE) {
    $value = str_replace('http://', 'https://', $value);
  }
  if ($explode) {
    $value = $this
      ->schemaMetatagManager()
      ->explode($value);

    // Clean out any empty values that might have been added by explode().
    if (is_array($value)) {
      $value = array_filter($value);
    }
  }
}