public function MetatagQuery::getMetatagFields in GatherContent 8.4
Same name and namespace in other branches
- 8.5 src/MetatagQuery.php \Drupal\gathercontent\MetatagQuery::getMetatagFields()
Get list of metatag fields.
Parameters
string $content_type: Machine name of content type.
Return value
array Array of metatag fields.
File
- src/
MetatagQuery.php, line 62
Class
- MetatagQuery
- Class for querying metatag data.
Namespace
Drupal\gathercontentCode
public function getMetatagFields($content_type) {
$instances = $this->entityFieldManager
->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;
}