1 user_compare_layout_access.inc UserCompareLayoutAccess::form(&$form, &$form_state)

Settings form for configuring this access item.

Overrides LayoutAccess::form

File

core/modules/layout/plugins/access/user_compare_layout_access.inc, line 73
Contains UserCompareLayoutAccess class.

Class

UserCompareLayoutAccess
Plugin to provide access if two user account contexts are the same.

Code

function form(&$form, &$form_state) {
  parent::form($form, $form_state);
  $form['help_text'] = array(
    '#type' => 'help',
    '#value' => t('Compare a user account to the currently logged-in user account. For someone viewing their own profile page, for example, choose "User account being viewed" and say "Display if the above user account is" and "the same as the logged-in user account".'),
  );
  // Always assume the first context is the logged-in user account.
  $form['contexts']['user1'] = array(
    '#type' => 'value',
    '#value' => 'current_user',
  );
  // Remove logged-in user account from list of comparison options.
  if (isset($form['contexts']['user2']['#options']['current_user'])) {
    unset($form['contexts']['user2']['#options']['current_user']);
  }
  $form['equality'] = array(
    '#type' => 'radios',
    '#title' => t('Comparison mode '),
    '#options' => array(
      1 => t('Display if this account is the logged-in user account.'),
      0 => t('Display if this account is different from the logged-in user account.'),
    ),
    '#default_value' => $this->settings['equality'],
  );
}