You are here

function check_metatag in GatherContent 8.3

Check if content type has any metatag fields.

Parameters

string $content_type: Machine name of content type.

Return value

bool TRUE if metatag field exists.

2 calls to check_metatag()
gathercontent_upload_process in ./gathercontent.module
Upload batch operation callback.
gc_gc_process_metatag_pane in ./gathercontent.module
Processing function for metatag panes.

File

./gathercontent.module, line 1222
Main module file for GatherContent module.

Code

function check_metatag($content_type) {
  $instances = \Drupal::service('entity_field.manager')
    ->getFieldDefinitions('node', $content_type);
  foreach ($instances as $name => $instance) {

    /** @var \Drupal\Core\Field\FieldDefinitionInterface $instance */
    if ($instance
      ->getType() === 'metatag') {
      return TRUE;
    }
  }
  return FALSE;
}