This access rule plugin checks entity existence (this means entity ID existence).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maximpodorov’s picture

maximpodorov’s picture

andypost’s picture

  1. +++ b/plugins/access/entity_exists.inc
    @@ -0,0 +1,60 @@
    +    $child_plugin['title'] = $entity['label'] .  ': ' . t('exists');
    

    Suppose better check_plain($entity[label])

  2. +++ b/plugins/access/entity_exists.inc
    @@ -0,0 +1,60 @@
    +  return (!is_null($entity_id));
    ...
    +  $entity_id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
    

    !empty($entity->{$info['entity keys']['id']}) should be enough

maximpodorov’s picture

Your fixes are applied.

Chris Matthews’s picture

The 5 year old patch in #4 to entity_exists.inc still applies cleanly to the latest ctools 7.x-1.x-dev, but needs to be officially reviewed and tested by the community.

Applied patch plugins/access/entity_exists.inc cleanly.