You are here

public function PasswordPolicy::adminForm in Password Policy 7.2

Creates the administration form for this policy.

File

includes/PasswordPolicy.inc, line 39
Contains PasswordPolicy.

Class

PasswordPolicy
Defines a class used for managing Password Policies.

Code

public function adminForm(&$form, &$form_state) {

  // Condition settings.
  $form['condition_title'] = array(
    '#type' => 'item',
    '#title' => t('Conditions'),
  );
  $form['condition'] = array(
    '#type' => 'vertical_tabs',
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'password_policy') . '/password_policy.js',
      ),
    ),
  );

  // Constraint settings.
  $form['constraint_title'] = array(
    '#type' => 'item',
    '#title' => t('Constraints'),
  );
  $form['constraint'] = array(
    '#type' => 'vertical_tabs',
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'password_policy') . '/password_policy.js',
      ),
    ),
  );

  // Item settings.
  $form['item_title'] = array(
    '#type' => 'item',
    '#title' => t('Other settings'),
  );
  $form['item'] = array(
    '#type' => 'container',
  );
  foreach ($this->items as $item) {
    $parent = $item
      ->isType('condition') ? 'condition' : ($item
      ->isType('constraint') ? 'constraint' : 'item');
    $form[$parent] = $form[$parent] + $item
      ->adminForm($form, $form_state);
  }
  return $form;
}