function page_theme_admin_edit in Page Theme 7.2
Same name and namespace in other branches
- 6 page_theme.admin.inc \page_theme_admin_edit()
- 7 page_theme.admin.inc \page_theme_admin_edit()
Menu callback; edits a rule.
1 string reference to 'page_theme_admin_edit'
- page_theme_menu in ./
page_theme.module - Implements hook_menu().
File
- ./
page_theme.admin.inc, line 180 - Admin page callbacks for the page_theme module.
Code
function page_theme_admin_edit($form, &$form_state, $rule) {
drupal_set_title(t('Configure rule %name', array(
'%name' => $rule->name,
)), PASS_THROUGH);
$form['ptid'] = array(
'#type' => 'value',
'#value' => $rule->ptid,
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#description' => t('The human-readable name of this rule. It is recommended that this name begin with a capital letter and contain only letters, numbers, and spaces. This name must be unique.'),
'#default_value' => $rule->name,
'#required' => TRUE,
'#size' => 30,
);
$form['rule'] = array(
'#type' => 'machine_name',
'#description' => t('A unique machine-readable name for this rule. It must only contain lowercase letters, numbers, and underscores. This name will be used for constructing the URL of the %page-theme page, in which underscores will be converted into hyphens.', array(
'%page-theme' => t('Page theme'),
)),
'#default_value' => $rule->rule,
'#maxlength' => 32,
'#machine_name' => array(
'exists' => 'page_theme_rule_load',
),
);
$form['theme'] = array(
'#type' => 'select',
'#title' => t('Theme'),
'#description' => t('Choose which theme the page(s) should display in.'),
'#default_value' => $rule->theme,
'#options' => page_theme_get_themes_options(),
'#required' => TRUE,
);
$form['pages'] = array(
'#type' => 'textarea',
'#title' => t('Pages'),
'#description' => t('Enter one path per line. The "*" character is a wildcard. Example paths are "node/1" for an individual piece of content or "node/*" for every piece of content. "@front" is the front page.', array(
'@front' => '<front>',
)),
'#default_value' => $rule->pages,
'#required' => TRUE,
);
$form['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#description' => t('Show this theme only for the selected role(s). If you select no roles, the block will be visible to all users.'),
'#default_value' => array_keys(page_theme_get_rule_roles($rule)),
'#options' => array_map('check_plain', user_roles()),
);
$form['status'] = array(
'#type' => 'checkboxes',
'#title' => t('Status'),
'#default_value' => $rule->status ? array(
'enabled',
) : array(),
'#options' => array(
'enabled' => t('Enabled'),
),
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $rule->weight,
'#delta' => 50,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update rule'),
);
return $form;
}