Révision c304a780
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/ctools/page_manager/plugins/tasks/page.admin.inc | ||
---|---|---|
47 | 47 |
'type' => MENU_CALLBACK, |
48 | 48 |
) + $base; |
49 | 49 |
|
50 |
// Add menu entries for each subtask |
|
50 |
// Add menu entries for each subtask.
|
|
51 | 51 |
foreach (page_manager_page_load_all() as $subtask_id => $subtask) { |
52 | 52 |
if (!empty($subtask->disabled)) { |
53 | 53 |
continue; |
... | ... | |
102 | 102 |
$page_arguments[] = $position; |
103 | 103 |
$access_arguments[] = $position; |
104 | 104 |
} |
105 |
else if ($bit[0] != '!') {
|
|
105 |
elseif ($bit[0] != '!') { |
|
106 | 106 |
$path[] = $bit; |
107 | 107 |
} |
108 | 108 |
|
109 | 109 |
// Increment position. We do it like this to skip empty items that |
110 |
// could happen from erroneous paths like: this///that |
|
110 |
// could happen from erroneous paths like: this///that.
|
|
111 | 111 |
$position++; |
112 | 112 |
} |
113 | 113 |
|
... | ... | |
171 | 171 |
|
172 | 172 |
case 'normal': |
173 | 173 |
$item['type'] = MENU_NORMAL_ITEM; |
174 |
// Insert item into the proper menu |
|
174 |
// Insert item into the proper menu.
|
|
175 | 175 |
$item['menu_name'] = $menu['name']; |
176 | 176 |
break; |
177 | 177 |
|
... | ... | |
261 | 261 |
if (isset($form_info['add order'][$id])) { |
262 | 262 |
$form_info['order'][$id] = $form_info['add order'][$id]; |
263 | 263 |
} |
264 |
else if (isset($handler_plugin['add features'][$id])) {
|
|
264 |
elseif (isset($handler_plugin['add features'][$id])) { |
|
265 | 265 |
$form_info['order'][$id] = $handler_plugin['add features'][$id]; |
266 | 266 |
} |
267 |
else if (isset($handler_plugin['required forms'][$id])) {
|
|
267 |
elseif (isset($handler_plugin['required forms'][$id])) { |
|
268 | 268 |
$form_info['order'][$id] = $handler_plugin['required forms'][$id]; |
269 | 269 |
} |
270 | 270 |
} |
... | ... | |
279 | 279 |
// our questions determined would be next. |
280 | 280 |
if ($step == 'next') { |
281 | 281 |
$keys = array_keys($form_info['order']); |
282 |
// get rid of 'basic' from the list of forms.
|
|
282 |
// Get rid of 'basic' from the list of forms.
|
|
283 | 283 |
array_shift($keys); |
284 | 284 |
$step = array_shift($keys); |
285 | 285 |
|
... | ... | |
416 | 416 |
'#default_value' => $page->admin_description, |
417 | 417 |
); |
418 | 418 |
|
419 |
// path
|
|
419 |
// Path.
|
|
420 | 420 |
$form['path'] = array( |
421 | 421 |
'#type' => 'textfield', |
422 | 422 |
'#title' => t('Path'), |
... | ... | |
452 | 452 |
'#description' => t('Admin overlays are used in many places in Drupal 7 and administrative custom pages should probably utilize this feature.'), |
453 | 453 |
); |
454 | 454 |
} |
455 |
else if ($path == $frontpage) {
|
|
455 |
elseif ($path == $frontpage) { |
|
456 | 456 |
$form['frontpage_markup'] = array( |
457 | 457 |
'#value' => '<b>' . t('This page is currently set to be your site home page. This can be modified on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/settings/site-information'))) . '</b>', |
458 | 458 |
); |
... | ... | |
516 | 516 |
$path = array(); |
517 | 517 |
if (empty($form_state['values']['path'])) { |
518 | 518 |
form_error($form['path'], t('Path is required.')); |
519 |
// stop processing here if there is no path.
|
|
519 |
// Stop processing here if there is no path.
|
|
520 | 520 |
return; |
521 | 521 |
} |
522 | 522 |
|
... | ... | |
542 | 542 |
|
543 | 543 |
$path[] = '%'; |
544 | 544 |
} |
545 |
else if ($bit[0] == '!') {
|
|
545 |
elseif ($bit[0] == '!') { |
|
546 | 546 |
$found = TRUE; |
547 | 547 |
} |
548 | 548 |
else { |
... | ... | |
620 | 620 |
$title = !empty($form_state['values']['title']) ? $form_state['values']['title'] : $plugin['title']; |
621 | 621 |
page_manager_handler_add_to_page($cache, $handler, $title); |
622 | 622 |
|
623 |
// Figure out which forms to present them with |
|
623 |
// Figure out which forms to present them with.
|
|
624 | 624 |
$cache->forms = array(); |
625 |
$cache->forms[] = 'basic'; // This one is always there. |
|
625 |
// This one is always there. |
|
626 |
$cache->forms[] = 'basic'; |
|
626 | 627 |
if (!empty($form_state['arguments'])) { |
627 | 628 |
$cache->forms[] = 'argument'; |
628 | 629 |
} |
... | ... | |
787 | 788 |
function page_manager_page_form_menu_validate(&$form, &$form_state) { |
788 | 789 |
// If setting a 'normal' menu entry, make sure that any placeholders |
789 | 790 |
// support the to_arg stuff. |
790 |
|
|
791 | 791 |
if ($form_state['values']['menu']['type'] == 'normal') { |
792 | 792 |
$page = $form_state['page']->subtask['subtask']; |
793 | 793 |
|
... | ... | |
876 | 876 |
if (isset($page->temporary_arguments[$keyword]) && !empty($form_state['allow temp'])) { |
877 | 877 |
$conf = $page->temporary_arguments[$keyword]; |
878 | 878 |
} |
879 |
else if (isset($page->arguments[$keyword])) {
|
|
879 |
elseif (isset($page->arguments[$keyword])) { |
|
880 | 880 |
$conf = $page->arguments[$keyword]; |
881 | 881 |
} |
882 | 882 |
|
... | ... | |
896 | 896 |
$form['table']['argument'][$keyword]['#position'] = $position; |
897 | 897 |
$form['table']['argument'][$keyword]['#context'] = $context; |
898 | 898 |
|
899 |
// The URL for this ajax button |
|
899 |
// The URL for this ajax button.
|
|
900 | 900 |
$form['table']['argument'][$keyword]['change-url'] = array( |
901 | 901 |
'#attributes' => array('class' => array("page-manager-context-$keyword-change-url")), |
902 | 902 |
'#type' => 'hidden', |
... | ... | |
913 | 913 |
|
914 | 914 |
// Only show the button if this has a settings form available: |
915 | 915 |
if (!empty($plugin)) { |
916 |
// The URL for this ajax button |
|
916 |
// The URL for this ajax button.
|
|
917 | 917 |
$form['table']['argument'][$keyword]['settings-url'] = array( |
918 | 918 |
'#attributes' => array('class' => array("page-manager-context-$keyword-settings-url")), |
919 | 919 |
'#type' => 'hidden', |
... | ... | |
970 | 970 |
} |
971 | 971 |
|
972 | 972 |
/** |
973 |
* Ajax entry point to edit an item |
|
973 |
* Ajax entry point to edit an item.
|
|
974 | 974 |
*/ |
975 | 975 |
function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL, $keyword = NULL) { |
976 | 976 |
ctools_include('ajax'); |
... | ... | |
995 | 995 |
return ctools_ajax_render_error(t('Invalid keyword.')); |
996 | 996 |
} |
997 | 997 |
|
998 |
// Set up wizard info |
|
998 |
// Set up wizard info.
|
|
999 | 999 |
$form_info = array( |
1000 | 1000 |
'id' => 'page_manager_page_argument', |
1001 | 1001 |
'path' => "admin/structure/pages/argument/%step/$task_name/$keyword", |
... | ... | |
1032 | 1032 |
if (!empty($form_state['cancel'])) { |
1033 | 1033 |
$commands = array(ctools_modal_command_dismiss()); |
1034 | 1034 |
} |
1035 |
else if (!empty($form_state['complete'])) {
|
|
1035 |
elseif (!empty($form_state['complete'])) { |
|
1036 | 1036 |
if (isset($page->temporary_arguments[$keyword])) { |
1037 | 1037 |
$page->arguments[$keyword] = $page->temporary_arguments[$keyword]; |
1038 | 1038 |
} |
... | ... | |
1051 | 1051 |
// fully processed, but is guaranteed to produce the same form we |
1052 | 1052 |
// started with so we don't have to do crazy stuff to rerender |
1053 | 1053 |
// just part of it. |
1054 |
|
|
1055 | 1054 |
// @todo should there be a tool to do this? |
1056 | 1055 |
|
1057 | 1056 |
$clone_state = $form_state; |
... | ... | |
1174 | 1173 |
if (is_array($plugin['default'])) { |
1175 | 1174 |
$settings = $plugin['default']; |
1176 | 1175 |
} |
1177 |
else if (function_exists($plugin['default'])) {
|
|
1176 |
elseif (function_exists($plugin['default'])) { |
|
1178 | 1177 |
$settings = $plugin['default'](); |
1179 | 1178 |
} |
1180 | 1179 |
} |
... | ... | |
1201 | 1200 |
if (isset($page->temporary_arguments[$keyword])) { |
1202 | 1201 |
$conf = $page->temporary_arguments[$keyword]; |
1203 | 1202 |
} |
1204 |
else if (isset($page->arguments[$keyword])) {
|
|
1203 |
elseif (isset($page->arguments[$keyword])) { |
|
1205 | 1204 |
$conf = $page->temporary_arguments[$keyword] = $page->arguments[$keyword]; |
1206 | 1205 |
} |
1207 | 1206 |
|
... | ... | |
1271 | 1270 |
} |
1272 | 1271 |
|
1273 | 1272 |
/** |
1274 |
* Import a task handler from cut & paste |
|
1273 |
* Import a task handler from cut & paste.
|
|
1275 | 1274 |
*/ |
1276 | 1275 |
function page_manager_page_import_subtask($form, &$form_state, $task_name) { |
1277 | 1276 |
$form_state['task'] = page_manager_get_task($task_name); |
... | ... | |
1414 | 1413 |
'#description' => t('Enter the name to the new page It must be unique and contain only alphanumeric characters and underscores.'), |
1415 | 1414 |
); |
1416 | 1415 |
|
1417 |
// path
|
|
1416 |
// Path.
|
|
1418 | 1417 |
$form['path'] = array( |
1419 | 1418 |
'#type' => 'textfield', |
1420 | 1419 |
'#title' => t('Path'), |
... | ... | |
1449 | 1448 |
} |
1450 | 1449 |
|
1451 | 1450 |
/** |
1452 |
* submit clone page form.
|
|
1451 |
* Submit clone page form.
|
|
1453 | 1452 |
* |
1454 | 1453 |
* Load the page, change the name(s) to protect the innocent, and if |
1455 | 1454 |
* requested, load all the task handlers so that they get saved properly too. |
Formats disponibles : Unified diff
Weekly update of contrib modules