Issue #2148709 by amateescu, xjm: CommentManager::getFields() should not try to get fields for config entity types.

8.0.x
webchick 2013-12-03 11:22:17 -08:00
parent a38172dc20
commit e900586b98
2 changed files with 8 additions and 6 deletions

View File

@ -56,12 +56,14 @@ class CommentManager implements CommentManagerInterface {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getFields($entity_type = NULL) { public function getFields($entity_type) {
$map = $this->getAllFields(); $info = $this->entityManager->getDefinition($entity_type);
if (!isset($map[$entity_type])) { if (!is_subclass_of($info['class'], '\Drupal\Core\Entity\ContentEntityInterface')) {
return array(); return array();
} }
return $map[$entity_type];
$map = $this->getAllFields();
return isset($map[$entity_type]) ? $map[$entity_type] : array();
} }
/** /**

View File

@ -27,7 +27,7 @@ interface CommentManagerInterface {
* Utility function to return an array of comment fields. * Utility function to return an array of comment fields.
* *
* @param string $entity_type * @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 * @return array
* An array of comment field map definitions, keyed by field name. Each * An array of comment field map definitions, keyed by field name. Each
@ -38,7 +38,7 @@ interface CommentManagerInterface {
* *
* @see field_info_field_map() * @see field_info_field_map()
*/ */
public function getFields($entity_type = NULL); public function getFields($entity_type);
/** /**
* Utility function to return all comment fields. * Utility function to return all comment fields.