You are here

function party_hat_user_party_hat_access_settings in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_hat/plugins/access/user_party_hat.inc \party_hat_user_party_hat_access_settings()

Settings form for the User's Party Hat access plugin

1 string reference to 'party_hat_user_party_hat_access_settings'
user_party_hat.inc in modules/party_hat/plugins/access/user_party_hat.inc
Plugin to provide access control based upon hat context.

File

modules/party_hat/plugins/access/user_party_hat.inc, line 26
Plugin to provide access control based upon hat context.

Code

function party_hat_user_party_hat_access_settings($form, &$form_state, $conf) {
  $form['settings']['#tree'] = TRUE;
  $form['settings']['hat_name'] = array(
    '#title' => t('Hats'),
    '#description' => t('Select one or more hats.'),
    '#default_value' => !empty($conf['hat_name']) ? $conf['hat_name'] : '',
    '#multiple' => TRUE,
    '#type' => 'checkboxes',
    '#options' => array(),
  );

  // @todo: replace with party_het_get_tree when drupal.org/node/1613400 goes in
  foreach (party_hat_get_all_hats() as $hat_name => $hat) {
    $form['settings']['hat_name']['#options'][$hat->name] = $hat->label;
  }
  return $form;
}