You are here

function devel_node_access_form_alter in Devel 7

Same name and namespace in other branches
  1. 5 devel_node_access.module \devel_node_access_form_alter()
  2. 6 devel_node_access.module \devel_node_access_form_alter()

Implements hook_form_alter().

Adds form elements to devel_admin_settings() and devel_node_access_admin_settings().

File

./devel_node_access.module, line 116
Functions for debugging node access permissions.

Code

function devel_node_access_form_alter(&$form, $form_state, $form_id) {
  $tr = 't';
  if ($form_id == 'devel_admin_settings' || $form_id == 'devel_node_access_admin_settings') {
    $form['devel_node_access'] = array(
      '#type' => 'fieldset',
      '#title' => t('Devel Node Access'),
      '#collapsible' => TRUE,
    );
    $form['devel_node_access']['devel_node_access_debug_mode'] = array(
      '#type' => 'checkbox',
      '#title' => t('Debug mode'),
      '#default_value' => variable_get('devel_node_access_debug_mode', FALSE),
      '#description' => t('Debug mode verifies the grant records in the node_access table against those that would be set by running !Rebuild_permissions, and displays them all; this can cause considerable overhead.<br />For even more information enable the <a href="@link">%DNAbU block</a>, too.', array(
        '!Rebuild_permissions' => l('[' . $tr('Rebuild permissions') . ']', 'admin/reports/status/rebuild'),
        '%DNAbU' => t('Devel Node Access by User'),
        '@link' => url('admin/structure/block/list'),
      )),
    );
    $form['devel_node_access']['devel_node_access_user_ajax'] = array(
      '#type' => 'checkbox',
      '#title' => t('Asynchronously populate the <em>Devel Node Access by User</em> block'),
      '#default_value' => variable_get('devel_node_access_user_ajax', FALSE),
      '#description' => t("Use Ajax to populate the second DNA block. This loads the initial page faster and uses dynamic calls to build the data in the table, one request at a time. It's especially useful during development, if some of the calls are failing.") . '<br />' . t('JavaScript must be enabled in your browser.'),
    );

    // push the Save button down
    $form['actions']['#weight'] = 10;
  }
}