Commit e900586b authored by webchick's avatar webchick

Issue #2148709 by amateescu, xjm: CommentManager::getFields() should not try...

Issue #2148709 by amateescu, xjm: CommentManager::getFields() should not try to get fields for config entity types.
parent a38172dc
......@@ -56,12 +56,14 @@ public function getParentEntityUri(CommentInterface $comment) {
/**
* {@inheritdoc}
*/
public function getFields($entity_type = NULL) {
$map = $this->getAllFields();
if (!isset($map[$entity_type])) {
public function getFields($entity_type) {
$info = $this->entityManager->getDefinition($entity_type);
if (!is_subclass_of($info['class'], '\Drupal\Core\Entity\ContentEntityInterface')) {
return array();
}
return $map[$entity_type];
$map = $this->getAllFields();
return isset($map[$entity_type]) ? $map[$entity_type] : array();
}
/**
......
......@@ -27,7 +27,7 @@ public function getParentEntityUri(CommentInterface $comment);
* Utility function to return an array of comment fields.
*
* @param string $entity_type
* The entity type to return fields which are attached on.
* The content entity type to which the comment fields are attached.
*
* @return array
* An array of comment field map definitions, keyed by field name. Each
......@@ -38,7 +38,7 @@ public function getParentEntityUri(CommentInterface $comment);
*
* @see field_info_field_map()
*/
public function getFields($entity_type = NULL);
public function getFields($entity_type);
/**
* Utility function to return all comment fields.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment