You are here

protected function MappingSteps::filterMetatags in GatherContent 8.5

Same name and namespace in other branches
  1. 8.4 gathercontent_ui/src/Form/MappingEditSteps/MappingSteps.php \Drupal\gathercontent_ui\Form\MappingEditSteps\MappingSteps::filterMetatags()

Return only supported metatag fields.

Parameters

object $gathercontent_field: Object of field from GatherContent.

string $content_type: Machine name of the content type.

string $entity_type: Machine name of the entity type.

Return value

array Array of supported metatag fields.

2 calls to MappingSteps::filterMetatags()
MappingStepEdit::getForm in gathercontent_ui/src/Form/MappingEditSteps/MappingStepEdit.php
Returns form array.
MappingStepNew::getForm in gathercontent_ui/src/Form/MappingEditSteps/MappingStepNew.php
Returns form array.

File

gathercontent_ui/src/Form/MappingEditSteps/MappingSteps.php, line 566

Class

MappingSteps
Class MappingSteps.

Namespace

Drupal\gathercontent_ui\Form\MappingEditSteps

Code

protected function filterMetatags($gathercontent_field, $content_type, $entity_type = 'node') {
  if ($gathercontent_field->type === 'text' && isset($gathercontent_field->metaData->isPlain) && $gathercontent_field->metaData->isPlain) {

    /** @var \Drupal\gathercontent\MetatagQuery $metatagQuery */
    $metatagQuery = \Drupal::service('gathercontent.metatag');
    return $metatagQuery
      ->getMetatagFields($entity_type, $content_type);
  }
  else {
    return [];
  }
}