function node_access_test_language_enable

Implements hook_enable().

Creates the 'private' field, which allows the node to be marked as private (restricted access) in a given translation.

File

drupal/core/modules/node/tests/modules/node_access_test_language/node_access_test_language.module, line 51
Test module with a language-aware node access implementation.

Code

function node_access_test_language_enable() {
  $field_private = array(
    'field_name' => 'field_private',
    'type' => 'list_boolean',
    'cardinality' => 1,
    'translatable' => TRUE,
    'settings' => array(
      'allowed_values' => array(
        0 => 'Not private',
        1 => 'Private',
      ),
    ),
  );
  $field_private = field_create_field($field_private);
  $instance = array(
    'field_name' => $field_private['field_name'],
    'entity_type' => 'node',
    'bundle' => 'page',
    'widget' => array(
      'type' => 'options_buttons',
    ),
  );
  $instance = field_create_instance($instance);
}