HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux newsites.squeezer-software.com 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/sites/orpis/modules/simpletest/tests/entity_query_access_test.module
<?php

/**
 * @file
 * Helper module for testing EntityFieldQuery access on any type of entity.
 */

/**
 * Implements hook_menu().
 */
function entity_query_access_test_menu() {
  $items['entity-query-access/test/%'] = array(
    'title' => "Retrieve a sample of entity query access data",
    'page callback' => 'entity_query_access_test_sample_query',
    'page arguments' => array(2),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/**
 * Returns the results from an example EntityFieldQuery.
 */
function entity_query_access_test_sample_query($field_name) {
  global $user;

  // Simulate user does not have access to view all nodes.
  $access = &drupal_static('node_access_view_all_nodes');
  $access[$user->uid] = FALSE;

  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'test_entity_bundle_key')
    ->fieldCondition($field_name, 'value', 0, '>')
    ->entityOrderBy('entity_id', 'ASC');
  $results = array(
    'items' => array(),
    'title' => t('EntityFieldQuery results'),
  );
  foreach ($query->execute() as $entity_type => $entity_ids) {
    foreach ($entity_ids as $entity_id => $entity_stub) {
      $results['items'][] = format_string('Found entity of type @entity_type with id @entity_id', array('@entity_type' => $entity_type, '@entity_id' => $entity_id));
    }
  }
  if (count($results['items']) > 0) {
    $output = theme('item_list', $results);
  }
  else {
    $output = 'No results found with EntityFieldQuery.';
  }
  return $output;
}