public function CommentManager::getFields in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/comment/src/CommentManager.php \Drupal\comment\CommentManager::getFields()
Utility function to return an array of comment fields.
Parameters
string $entity_type_id: The content entity type to which the comment fields are attached.
Return value
array An array of comment field map definitions, keyed by field name. Each value is an array with two entries:
- type: The field type.
- bundles: The bundles in which the field appears, as an array with entity types as keys and the array of bundle names as values.
Overrides CommentManagerInterface::getFields
See also
\Drupal\Core\Entity\EntityManagerInterface::getFieldMap()
File
- core/
modules/ comment/ src/ CommentManager.php, line 105 - Contains \Drupal\comment\CommentManager.
Class
- CommentManager
- Comment manager contains common functions to manage comment fields.
Namespace
Drupal\commentCode
public function getFields($entity_type_id) {
$entity_type = $this->entityManager
->getDefinition($entity_type_id);
if (!$entity_type
->isSubclassOf('\\Drupal\\Core\\Entity\\FieldableEntityInterface')) {
return array();
}
$map = $this->entityManager
->getFieldMapByFieldType('comment');
return isset($map[$entity_type_id]) ? $map[$entity_type_id] : array();
}