access_policy-1.0.x-dev/tests/modules/access_policy_test/access_policy_test.module

tests/modules/access_policy_test/access_policy_test.module
<?php

/**
 * @file
 * Hook implementations for the access_policy_test module.
 */

/**
 * Implements hook_access_policy_data().
 */
function access_policy_test_access_policy_data() {
  $data = [];
  // @todo change or remove this. Field should be required.
  $data['node']['access_rule_test'] = [
    'plugin_id' => 'access_rule_test',
    'label' => t('Access Rule Test'),
    'description' => t('Used for testing Access Rules.'),
    'field' => '',
  ];

  // This is for testing the broken handler. "invalid_plugin" does not exist.
  $data['node']['invalid_plugin'] = [
    'plugin_id' => 'invalid_plugin',
    'label' => t('Broken access rule'),
    'description' => t('This access rules has an invalid plugin id.'),
    'field' => 'field_text',
  ];

  return $data;
}

/**
 * Implements hook_access_policy_data_alter().
 */
function access_policy_test_access_policy_data_alter(&$data) {
  // This is for testing the alter hook.
  $data['node']['field_text']['description'] = t('Foo bar');
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc