public function MetatagQuery::checkMetatag in GatherContent 8.4
Same name and namespace in other branches
- 8.5 src/MetatagQuery.php \Drupal\gathercontent\MetatagQuery::checkMetatag()
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.
File
- src/
MetatagQuery.php, line 41
Class
- MetatagQuery
- Class for querying metatag data.
Namespace
Drupal\gathercontentCode
public function checkMetatag($content_type) {
$instances = $this->entityFieldManager
->getFieldDefinitions('node', $content_type);
foreach ($instances as $name => $instance) {
/** @var \Drupal\Core\Field\FieldDefinitionInterface $instance */
if ($instance
->getType() === 'metatag') {
return TRUE;
}
}
return FALSE;
}