You are here

function get_metatag_fields in GatherContent 8.3

Get list of metatag fields.

Parameters

string $content_type: Machine name of content type.

Return value

array Array of metatag fields.

2 calls to get_metatag_fields()
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 1243
Main module file for GatherContent module.

Code

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

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