Problem: If you have an entity type such as mailchimp_list which does not specify an access callback in its entity info, then all labels in your entityreference widget will be "Restricted access" and you cannot choose a maiclhimp list in a meaningful way.

Solution: entity_access() returns NULL if the entity type has no access callback, and in that case we should display the entity label as usual.

Comments

klausi’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Patch attached.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch to EntityReference_SelectionHandler_Generic.class.php does not apply to the latest 7.x-1.x-dev and if still relevant needs a reroll.

Checking patch plugins/selection/EntityReference_SelectionHandler_Generic.class.php...
error: while searching for:
   */
  public function getLabel($entity) {
    $target_type = $this->field['settings']['target_type'];
    return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t('- Restricted access -');
  }

  /**

error: patch failed: plugins/selection/EntityReference_SelectionHandler_Generic.class.php:305
error: plugins/selection/EntityReference_SelectionHandler_Generic.class.php: patch does not apply