You are here

public function views_role_based_global_text_handler_extender::options_form in Views Role Based Global Text 7

Default options form that provides the label widget that all fields should have.

Overrides views_handler_area_text::options_form

File

views/views_role_based_global_text_handler_extender.inc, line 17
Handler which extends the views_handler_area_text to add roles for global text field.

Class

views_role_based_global_text_handler_extender
@file Handler which extends the views_handler_area_text to add roles for global text field.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['roles_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Roles'),
    '#weight' => 10,
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $roles_default_value = $this->options['roles_fieldset']['roles'];
  $form['roles_fieldset']['roles'] = array(
    '#type' => 'checkboxes',
    '#options' => drupal_map_assoc(user_roles()),
    '#title' => t('Select Role'),
    '#default_value' => isset($roles_default_value) ? $roles_default_value : array(),
    '#description' => t('Only the checked roles will be able to access this value. If no role is selected, available to all.'),
  );
}