| 1 |
<?php |
<?php |
| 2 |
// $Id: nodewords.admin.inc,v 1.1.2.109 2009/11/26 18:01:22 kiam Exp $ |
// $Id: nodewords.admin.inc,v 1.1.2.110 2009/11/26 19:52:50 kiam Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 56 |
$form = array('#tree' => TRUE); |
$form = array('#tree' => TRUE); |
| 57 |
$pages = array(); |
$pages = array(); |
| 58 |
|
|
|
_nodewords_check_enabled_modules(); |
|
|
|
|
| 59 |
foreach (_nodewords_get_pages_data() as $pid => $page) { |
foreach (_nodewords_get_pages_data() as $pid => $page) { |
| 60 |
$pages[$pid] = ''; |
$pages[$pid] = ''; |
| 61 |
|
|
| 131 |
* |
* |
| 132 |
*/ |
*/ |
| 133 |
function nodewords_pages_edit($form_state, $page = NULL) { |
function nodewords_pages_edit($form_state, $page = NULL) { |
| 134 |
if (!isset($page)) { |
$form = array(); |
| 135 |
$page = (object) array( |
$nodewords_form = nodewords_form( |
|
'name' => t('Custom page'), |
|
|
'path' => '', |
|
|
'weight' => 0, |
|
|
'enabled' => 1, |
|
|
'tags' => array(), |
|
|
); |
|
|
} |
|
|
else { |
|
|
$form['pid'] = array( |
|
|
'#type' => 'value', |
|
|
'#value' => $page->pid, |
|
|
); |
|
|
} |
|
|
|
|
|
$form['name'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Name'), |
|
|
'#description' => t("A name to better identify the page in the list of custom pages. The name must contains at least one alpha-numeric character."), |
|
|
'#default_value' => $page->name, |
|
|
'#size' => 60, |
|
|
'#maxlength' => 60, |
|
|
'#required' => TRUE, |
|
|
); |
|
|
|
|
|
$form['path'] = array( |
|
|
'#type' => 'textarea', |
|
|
'#title' => t('Path'), |
|
|
'#description' => t("Enter the Drupal paths associated with the page. The character <q>*</q> is a wildcard. Example paths are <em>blog</em> for the blog page and <em>blog/*</em> for every personal blog. The list must contain at least one path."), |
|
|
'#default_value' => $page->path, |
|
|
'#size' => 60, |
|
|
'#required' => TRUE, |
|
|
); |
|
|
|
|
|
$form['weight'] = array( |
|
|
'#type' => 'weight', |
|
|
'#title' => t('Weight'), |
|
|
'#description' => t('Pages with lower weight will be considered first. Only the first matching page will be used.'), |
|
|
'#delta' => 10, |
|
|
'#default_value' => $page->weight, |
|
|
); |
|
|
|
|
|
$form['enabled'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Enabled'), |
|
|
'#default_value' => $page->enabled, |
|
|
); |
|
|
|
|
|
$form['nodewords'] = nodewords_form( |
|
| 136 |
NODEWORDS_TYPE_PAGE, |
NODEWORDS_TYPE_PAGE, |
| 137 |
$page->tags, |
$page->tags, |
| 138 |
array( |
array( |
| 139 |
'fieldset' => FALSE, |
'fieldset' => FALSE, |
| 140 |
) |
) |
| 141 |
); |
); |
| 142 |
|
$result = _nodewords_check_enabled_modules(); |
| 143 |
|
|
| 144 |
if (empty($form['nodewords'])) { |
if (empty($nodewords_form)) { |
| 145 |
if (!count(array_filter(variable_get('nodewords_edit', array())))) { |
$bool = ( |
| 146 |
|
!$result && |
| 147 |
|
!count(array_filter(variable_get('nodewords_edit', array()))) |
| 148 |
|
); |
| 149 |
|
|
| 150 |
|
if ($bool) { |
| 151 |
drupal_set_message( |
drupal_set_message( |
| 152 |
t( |
t( |
| 153 |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
| 156 |
); |
); |
| 157 |
} |
} |
| 158 |
|
|
| 159 |
return array(); |
return $form; |
| 160 |
} |
} |
| 161 |
else { |
else { |
| 162 |
|
if (!isset($page)) { |
| 163 |
|
$page = (object) array( |
| 164 |
|
'name' => t('Custom page'), |
| 165 |
|
'path' => '', |
| 166 |
|
'weight' => 0, |
| 167 |
|
'enabled' => 1, |
| 168 |
|
'tags' => array(), |
| 169 |
|
); |
| 170 |
|
} |
| 171 |
|
else { |
| 172 |
|
$form['pid'] = array( |
| 173 |
|
'#type' => 'value', |
| 174 |
|
'#value' => $page->pid, |
| 175 |
|
); |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
$form['name'] = array( |
| 179 |
|
'#type' => 'textfield', |
| 180 |
|
'#title' => t('Name'), |
| 181 |
|
'#description' => t("A name to better identify the page in the list of custom pages. The name must contains at least one alpha-numeric character."), |
| 182 |
|
'#default_value' => $page->name, |
| 183 |
|
'#size' => 60, |
| 184 |
|
'#maxlength' => 60, |
| 185 |
|
'#required' => TRUE, |
| 186 |
|
); |
| 187 |
|
|
| 188 |
|
$form['path'] = array( |
| 189 |
|
'#type' => 'textarea', |
| 190 |
|
'#title' => t('Path'), |
| 191 |
|
'#description' => t("Enter the Drupal paths associated with the page. The character <q>*</q> is a wildcard. Example paths are <em>blog</em> for the blog page and <em>blog/*</em> for every personal blog. The list must contain at least one path."), |
| 192 |
|
'#default_value' => $page->path, |
| 193 |
|
'#size' => 60, |
| 194 |
|
'#required' => TRUE, |
| 195 |
|
); |
| 196 |
|
|
| 197 |
|
$form['weight'] = array( |
| 198 |
|
'#type' => 'weight', |
| 199 |
|
'#title' => t('Weight'), |
| 200 |
|
'#description' => t('Pages with lower weight will be considered first. Only the first matching page will be used.'), |
| 201 |
|
'#delta' => 10, |
| 202 |
|
'#default_value' => $page->weight, |
| 203 |
|
); |
| 204 |
|
|
| 205 |
|
$form['enabled'] = array( |
| 206 |
|
'#type' => 'checkbox', |
| 207 |
|
'#title' => t('Enabled'), |
| 208 |
|
'#default_value' => $page->enabled, |
| 209 |
|
); |
| 210 |
|
|
| 211 |
|
$form['nodewords'] = $nodeword_form; |
| 212 |
$form['nodewords']['#tree'] = TRUE; |
$form['nodewords']['#tree'] = TRUE; |
| 213 |
|
|
| 214 |
$form['submit'] = array( |
$form['submit'] = array( |
| 450 |
$form['#nodewords_type'] = $type; |
$form['#nodewords_type'] = $type; |
| 451 |
$form['#nodewords_id'] = $id; |
$form['#nodewords_id'] = $id; |
| 452 |
|
|
| 453 |
_nodewords_check_enabled_modules(); |
$result = _nodewords_check_enabled_modules(); |
| 454 |
|
|
| 455 |
$form['nodewords'] = nodewords_form( |
$form['nodewords'] = nodewords_form( |
| 456 |
$type, |
$type, |
| 461 |
); |
); |
| 462 |
|
|
| 463 |
if (empty($form['nodewords'])) { |
if (empty($form['nodewords'])) { |
| 464 |
if (!count(array_filter(variable_get('nodewords_edit', array())))) { |
$bool = ( |
| 465 |
|
!$result && |
| 466 |
|
!count(array_filter(variable_get('nodewords_edit', array()))) |
| 467 |
|
); |
| 468 |
|
|
| 469 |
|
if ($bool) { |
| 470 |
drupal_set_message( |
drupal_set_message( |
| 471 |
t( |
t( |
| 472 |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |
'No meta tags have been enabled for editing; enable them on the <a href="@settings_page">settings page</a>.', |