You are here

function protected_pages_edit in Protected Pages 7

Same name and namespace in other branches
  1. 7.2 protected_pages.admin.inc \protected_pages_edit()

Callback function for edit protected page form.

1 string reference to 'protected_pages_edit'
protected_pages_menu in ./protected_pages.module
Implements hook_menu().

File

./protected_pages.admin.inc, line 155
Provides page callbacks for configuration page.

Code

function protected_pages_edit($form, &$form_state, $pid) {
  $protected_page = db_select('protected_pages')
    ->fields('protected_pages', array(
    'path',
  ))
    ->condition('pid', $pid)
    ->execute()
    ->fetchObject();
  if (!isset($protected_page->path)) {
    drupal_access_denied();
    exit;
  }
  $form['rules_list'] = array(
    '#title' => t("Edit Protected Page Relative path and password."),
    '#type' => 'fieldset',
    '#prefix' => '<div id="rules_list">',
    '#suffix' => '</div>',
    '#description' => t('Please enter the relative path and its corresponding
    password. When user opens this url, they will assked to enter password to
    view this page. For example, "node/5", "new-events" etc.'),
  );
  $form['rules_list']['path'] = array(
    '#type' => 'textfield',
    '#title' => t('Relative Path'),
    '#description' => t('Enter relative drupal path. For example, "node/5", "new-events" etc.'),
    '#required' => TRUE,
    '#default_value' => $protected_page->path,
  );
  $form['rules_list']['password'] = array(
    '#type' => 'password_confirm',
    '#size' => 25,
  );
  $form['rules_list']['pid'] = array(
    '#type' => 'hidden',
    '#value' => $pid,
  );
  $form['rules_list']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}