diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-24 14:49:14 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-24 14:49:14 +0000 |
commit | 45f4a1e166d090e23cb385c3238835fce61d1607 (patch) | |
tree | 63384d78144e0caee7c6700c44e444a70fc58845 /modules | |
parent | 3e547ae045849264745f8cc456a0f379246060ea (diff) | |
download | brdo-45f4a1e166d090e23cb385c3238835fce61d1607.tar.gz brdo-45f4a1e166d090e23cb385c3238835fce61d1607.tar.bz2 |
- Patch #482816 by sun, Rob Loach: make a consistent wrapper around submit buttons.
Diffstat (limited to 'modules')
30 files changed, 136 insertions, 133 deletions
diff --git a/modules/aggregator/aggregator.admin.inc b/modules/aggregator/aggregator.admin.inc index 89d8355d5..8570a0d4e 100644 --- a/modules/aggregator/aggregator.admin.inc +++ b/modules/aggregator/aggregator.admin.inc @@ -109,13 +109,14 @@ function aggregator_form_feed($form, &$form_state, stdClass $feed = NULL) { '#description' => t('New feed items are automatically filed in the checked categories.'), ); } - $form['submit'] = array( + + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); - if (!empty($feed->fid)) { - $form['delete'] = array( + $form['actions']['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), ); @@ -270,7 +271,8 @@ function aggregator_form_opml($form, &$form_state) { '#description' => t('New feed items are automatically filed in the checked categories.'), ); } - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Import') ); @@ -478,7 +480,7 @@ function aggregator_admin_form($form, $form_state) { // Implementing modules will expect an array at $form['modules']. $form['modules'] = array(); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save configuration'), @@ -512,10 +514,10 @@ function aggregator_form_category($form, &$form_state, $edit = array('title' => '#title' => t('Description'), '#default_value' => $edit['description'], ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); - + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); if ($edit['cid']) { - $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); + $form['actions']['delete'] = array('#type' => 'submit', '#value' => t('Delete')); $form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']); } diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc index 1613a501a..be4dcd1ac 100644 --- a/modules/aggregator/aggregator.pages.inc +++ b/modules/aggregator/aggregator.pages.inc @@ -199,7 +199,7 @@ function aggregator_categorize_items($items, $feed_source = '') { '#multiple' => TRUE ); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save categories')); return $form; diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 1f5dab673..920b0d2c8 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -104,8 +104,7 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme) { $form['actions'] = array( '#tree' => FALSE, - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), + '#type' => 'actions', ); $form['actions']['submit'] = array( '#type' => 'submit', @@ -351,7 +350,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) { '#default_value' => isset($block->custom) ? $block->custom : 0, ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save block'), diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 94ba2ccd1..fa1fe1cbf 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1906,11 +1906,7 @@ function comment_form($form, &$form_state, $comment) { // already previewing the submission. However, if there are form errors, // we hide the save button no matter what, so that optional form elements // (e.g., captchas) can be updated. - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - '#weight' => 100, - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/contact/contact.admin.inc b/modules/contact/contact.admin.inc index a212db52b..8ad642270 100644 --- a/modules/contact/contact.admin.inc +++ b/modules/contact/contact.admin.inc @@ -108,10 +108,7 @@ function contact_category_edit_form($form, &$form_state, array $category = array '#type' => 'value', '#value' => $category['cid'], ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/contact/contact.pages.inc b/modules/contact/contact.pages.inc index 2ff99090a..fa7e1bcd3 100644 --- a/modules/contact/contact.pages.inc +++ b/modules/contact/contact.pages.inc @@ -101,10 +101,7 @@ function contact_site_form($form, &$form_state) { '#title' => t('Send yourself a copy.'), '#access' => $user->uid, ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Send message'), @@ -235,10 +232,7 @@ function contact_personal_form($form, &$form_state, $recipient) { '#title' => t('Send yourself a copy.'), '#access' => $user->uid, ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Send message'), diff --git a/modules/dblog/dblog.admin.inc b/modules/dblog/dblog.admin.inc index 1f5ba8833..bc09b5f8f 100644 --- a/modules/dblog/dblog.admin.inc +++ b/modules/dblog/dblog.admin.inc @@ -312,8 +312,8 @@ function dblog_filter_form($form) { } $form['filters']['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions', 'container-inline')), + '#type' => 'actions', + '#attributes' => array('class' => array('container-inline')), ); $form['filters']['actions']['submit'] = array( '#type' => 'submit', diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index f0c92578f..5c8b45e32 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -274,7 +274,8 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle $form['#field_rows'][] = $name; } - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); return $form; } @@ -624,7 +625,8 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund } } - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); return $form; } @@ -859,7 +861,7 @@ function field_ui_field_settings_form($form, &$form_state, $instance) { $form['#entity_type'] = $entity_type; $form['#bundle'] = $bundle; - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save field settings')); return $form; } @@ -922,7 +924,8 @@ function field_ui_widget_type_form($form, &$form_state, $instance) { ); $form['#instance'] = $instance; - $form['submit'] = array('#type' => 'submit', '#value' => t('Continue')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Continue')); $form['#validate'] = array(); $form['#submit'] = array('field_ui_widget_type_form_submit'); @@ -1160,7 +1163,8 @@ function field_ui_field_edit_form($form, &$form_state, $instance) { $form['field']['settings'] = $additions; } - $form['submit'] = array('#type' => 'submit', '#value' => t('Save settings')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save settings')); return $form; } diff --git a/modules/filter/filter.admin.inc b/modules/filter/filter.admin.inc index aa07dcab4..d19fe7edc 100644 --- a/modules/filter/filter.admin.inc +++ b/modules/filter/filter.admin.inc @@ -36,7 +36,7 @@ function filter_admin_overview($form) { $form['formats'][$id]['delete'] = array('#type' => 'link', '#title' => t('delete'), '#href' => 'admin/config/content/formats/' . $id . '/delete', '#access' => !$form['formats'][$id]['#is_fallback']); $form['formats'][$id]['weight'] = array('#type' => 'weight', '#default_value' => $format->weight); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save changes')); return $form; } @@ -230,7 +230,7 @@ function filter_admin_format_form($form, &$form_state, $format) { if (!empty($format->format)) { $form['format'] = array('#type' => 'value', '#value' => $format->format); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); return $form; diff --git a/modules/forum/forum.admin.inc b/modules/forum/forum.admin.inc index 607089f66..dbfc1edc4 100644 --- a/modules/forum/forum.admin.inc +++ b/modules/forum/forum.admin.inc @@ -55,7 +55,7 @@ function forum_form_forum($form, &$form_state, $edit = array()) { ); $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary', '')); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit' ] = array('#type' => 'submit', '#value' => t('Save')); if ($edit['tid']) { $form['actions']['delete'] = array('#type' => 'submit', '#value' => t('Delete')); @@ -160,7 +160,7 @@ function forum_form_container($form, &$form_state, $edit = array()) { '#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary', ''), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save') diff --git a/modules/image/image.admin.inc b/modules/image/image.admin.inc index e239384f4..cd822972e 100644 --- a/modules/image/image.admin.inc +++ b/modules/image/image.admin.inc @@ -141,14 +141,15 @@ function image_style_form($form, &$form_state, $style) { ); // Show the Override or Submit button for this style. - $form['override'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['override'] = array( '#type' => 'submit', '#value' => t('Override defaults'), '#validate' => array(), '#submit' => array('image_style_form_override_submit'), '#access' => !$editable, ); - $form['submit'] = array( + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Update style'), '#access' => $editable, @@ -393,7 +394,7 @@ function image_effect_form($form, &$form_state, $style, $effect) { '#value' => isset($_GET['weight']) ? intval($_GET['weight']) : (isset($effect['weight']) ? $effect['weight'] : count($style['effects'])), ); - $form['actions'] = array('#tree' => FALSE, '#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#tree' => FALSE, '#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => isset($effect['ieid']) ? t('Update effect') : t('Add effect'), diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc index 79ffbb3d6..a2ac18753 100644 --- a/modules/locale/locale.admin.inc +++ b/modules/locale/locale.admin.inc @@ -43,7 +43,7 @@ function locale_languages_overview_form() { '#options' => $options, '#default_value' => language_default('language'), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); $form['#theme'] = 'locale_languages_overview_form'; @@ -168,7 +168,7 @@ function locale_languages_predefined_form($form) { '#options' => $predefined, '#description' => t('Use the <em>Custom language</em> section below if your desired language does not appear in this list.'), ); - $form['language list']['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['language list']['actions'] = array('#type' => 'actions'); $form['language list']['actions']['submit'] = array('#type' => 'submit', '#value' => t('Add language')); return $form; } @@ -183,7 +183,7 @@ function locale_languages_custom_form($form) { '#collapsed' => TRUE, ); _locale_languages_common_controls($form['custom language']); - $form['custom language']['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['custom language']['actions'] = array('#type' => 'actions'); $form['custom language']['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Add custom language') @@ -203,7 +203,7 @@ function locale_languages_custom_form($form) { function locale_languages_edit_form($form, &$form_state, $langcode) { if ($language = db_query("SELECT * FROM {languages} WHERE language = :language", array(':language' => $langcode))->fetchObject()) { _locale_languages_common_controls($form, $language); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save language') @@ -483,7 +483,7 @@ function locale_languages_configure_form() { _locale_languages_configure_form_language_table($form, $type); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save settings'), @@ -862,7 +862,10 @@ function locale_translation_filter_form() { } } - $form['filters']['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions', 'container-inline'))); + $form['filters']['actions'] = array( + '#type' => 'actions', + '#attributes' => array('class' => array('container-inline')), + ); $form['filters']['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Filter'), @@ -1053,7 +1056,8 @@ function locale_translate_export_po_form($form, &$form_state, $names) { '#default_value' => 'default', '#options' => module_invoke_all('locale', 'groups'), ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Export')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Export')); return $form; } @@ -1071,7 +1075,8 @@ function locale_translate_export_pot_form() { '#default_value' => 'default', '#options' => module_invoke_all('locale', 'groups'), ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Export')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Export')); // Reuse PO export submission callback. $form['#submit'][] = 'locale_translate_export_po_form_submit'; return $form; @@ -1160,7 +1165,8 @@ function locale_translate_edit_form($form, &$form_state, $lid) { $form['translations'][$translation->language]['#default_value'] = $translation->translation; } - $form['submit'] = array('#type' => 'submit', '#value' => t('Save translations')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save translations')); return $form; } @@ -1385,7 +1391,7 @@ function locale_date_format_form($form, &$form_state, $langcode) { ); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save configuration'), diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 3483ee6d2..e105d4dbe 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -72,7 +72,7 @@ function menu_overview_form($form, &$form_state, $menu) { $form['#menu'] = $menu; if (element_children($form)) { - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save configuration'), @@ -339,7 +339,8 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) { '#default_value' => $item['weight'], '#description' => t('Optional. In the menu, the heavier links will sink and the lighter links will be positioned nearer the top.'), ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); return $form; } @@ -467,12 +468,13 @@ function menu_edit_menu($form, &$form_state, $type, $menu = array()) { '#title' => t('Description'), '#default_value' => $menu['description'], ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); // Only custom menus may be deleted. - $form['delete'] = array( + $form['actions']['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), '#access' => $type == 'edit' && !isset($system_menus[$menu['menu_name']]), diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index 8bca4653b..be7de61f2 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -245,7 +245,7 @@ function node_type_form($form, &$form_state, $type = NULL) { '#value' => $type->locked, ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save content type'), diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc index 11a818a97..15c0593ad 100644 --- a/modules/node/node.admin.inc +++ b/modules/node/node.admin.inc @@ -188,9 +188,9 @@ function node_filter_form() { } $form['filters']['actions'] = array( - '#type' => 'container', + '#type' => 'actions', '#id' => 'node-admin-buttons', - '#attributes' => array('class' => array('form-actions', 'container-inline')), + '#attributes' => array('class' => array('container-inline')), ); $form['filters']['actions']['submit'] = array('#type' => 'submit', '#value' => (count($session) ? t('Refine') : t('Filter'))); if (count($session)) { diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index d18e7a779..11dfd5768 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -247,11 +247,7 @@ function node_form($form, &$form_state, $node) { ); // Add the buttons. - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - '#weight' => 100, - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#access' => variable_get('node_preview_' . $node->type, DRUPAL_OPTIONAL) != DRUPAL_REQUIRED || (!form_get_errors() && isset($form_state['node_preview'])), diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc index 2957699ac..2c17d2c90 100644 --- a/modules/openid/openid.inc +++ b/modules/openid/openid.inc @@ -109,7 +109,8 @@ function openid_redirect_form($form, &$form_state, $url, $message) { '#value' => $value, ); } - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#prefix' => '<noscript>', '#suffix' => '</noscript>', diff --git a/modules/openid/openid.pages.inc b/modules/openid/openid.pages.inc index ac0d4dc52..db41e3b21 100644 --- a/modules/openid/openid.pages.inc +++ b/modules/openid/openid.pages.inc @@ -73,7 +73,7 @@ function openid_user_add() { '#type' => 'textfield', '#title' => t('OpenID'), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Add an OpenID')); return $form; } diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc index b400aa344..627a94a9d 100644 --- a/modules/path/path.admin.inc +++ b/modules/path/path.admin.inc @@ -122,10 +122,7 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali '#value' => $path['language'] ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 68c4627bd..729a51dc9 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -894,7 +894,8 @@ function poll_cancel_form($form, &$form_state, $nid) { // Store the nid so we can get to it in submit functions. $form['#nid'] = $nid; - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Cancel your vote'), '#submit' => array('poll_cancel') diff --git a/modules/profile/profile.admin.inc b/modules/profile/profile.admin.inc index d7d653b99..0bb13278a 100644 --- a/modules/profile/profile.admin.inc +++ b/modules/profile/profile.admin.inc @@ -40,7 +40,8 @@ function profile_admin_overview($form) { // Display the submit button only when there's more than one field if (count($form) > 1) { - $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); } else { // Disable combo boxes when there isn't a submit button @@ -105,7 +106,7 @@ function theme_profile_admin_overview($variables) { drupal_add_css(drupal_get_path('module', 'profile') . '/profile.css'); // Add javascript if there's more than one field. - if (isset($form['submit'])) { + if (isset($form['actions'])) { drupal_add_js(drupal_get_path('module', 'profile') . '/profile.js'); } @@ -127,7 +128,7 @@ function theme_profile_admin_overview($variables) { $rows[] = array('data' => array(array('data' => '<em>' . t('No fields in this category. If this category remains empty when saved, it will be removed.') . '</em>', 'colspan' => 7)), 'class' => array('category-' . $category_number . '-message', 'category-message', 'category-populated')); // Make it draggable only if there is more than one field - if (isset($form['submit'])) { + if (isset($form['actions'])) { drupal_add_tabledrag('profile-fields', 'order', 'sibling', 'profile-weight', 'profile-weight-' . $category_number); drupal_add_tabledrag('profile-fields', 'match', 'sibling', 'profile-category', 'profile-category-' . $category_number); } @@ -143,7 +144,7 @@ function theme_profile_admin_overview($variables) { $row[] = drupal_render($field['title']); $row[] = drupal_render($field['name']); $row[] = drupal_render($field['type']); - if (isset($form['submit'])) { + if (isset($form['actions'])) { $row[] = drupal_render($field['category']); $row[] = drupal_render($field['weight']); } @@ -154,7 +155,7 @@ function theme_profile_admin_overview($variables) { } $header = array(t('Title'), t('Name'), t('Type')); - if (isset($form['submit'])) { + if (isset($form['actions'])) { $header[] = t('Category'); $header[] = t('Weight'); } @@ -286,7 +287,7 @@ Unless you know what you are doing, it is highly recommended that you prefix the '#default_value' => $edit['register'], ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save field'), ); diff --git a/modules/search/search.module b/modules/search/search.module index 5f93be089..ab225993f 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -935,7 +935,8 @@ function search_box($form, &$form_state, $form_id) { '#default_value' => '', '#attributes' => array('title' => t('Enter the terms you wish to search for.')), ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Search')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Search')); $form['#submit'][] = 'search_box_form_submit'; return $form; diff --git a/modules/shortcut/shortcut.admin.inc b/modules/shortcut/shortcut.admin.inc index 2db30f220..e86d8f50f 100644 --- a/modules/shortcut/shortcut.admin.inc +++ b/modules/shortcut/shortcut.admin.inc @@ -85,7 +85,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) { 'js' => array(drupal_get_path('module', 'shortcut') . '/shortcut.admin.js'), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Change set'), @@ -193,7 +193,7 @@ function shortcut_set_add_form($form, &$form_state) { '#description' => t('The new set is created by copying items from your default shortcut set.'), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Create new set'), @@ -269,7 +269,7 @@ function shortcut_set_customize($form, &$form_state, $shortcut_set) { 'js' => array(drupal_get_path('module', 'shortcut') . '/shortcut.admin.js'), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save changes'), @@ -453,7 +453,7 @@ function _shortcut_link_form_elements($shortcut_link = NULL) { $form['#validate'][] = 'shortcut_link_edit_validate'; - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), @@ -562,11 +562,7 @@ function shortcut_set_edit_form($form, &$form_state, $shortcut_set) { '#required' => TRUE, '#weight' => -5, ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - '#weight' => 100, - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index aa70243e0..277fc3d70 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -345,7 +345,7 @@ function system_themes_admin_form($form, &$form_state, $theme_options) { '#title' => t('Use the administration theme when editing or creating content'), '#default_value' => variable_get('node_admin_theme', '0'), ); - $form['admin_theme']['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['admin_theme']['actions'] = array('#type' => 'actions'); $form['admin_theme']['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save configuration'), @@ -950,7 +950,7 @@ function system_modules($form, $form_state = array()) { ); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save configuration'), @@ -1307,7 +1307,7 @@ function system_modules_uninstall($form, $form_state = NULL) { '#type' => 'checkboxes', '#options' => $options, ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Uninstall'), @@ -1439,7 +1439,8 @@ function system_ip_blocking_form($form, $form_state, $default_ip) { '#default_value' => $default_ip, '#description' => t('Enter a valid IP address.'), ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), ); @@ -2076,7 +2077,8 @@ function system_add_date_format_type_form($form, &$form_state) { '#required' => TRUE, ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Add date type'), ); @@ -2779,7 +2781,7 @@ function system_configure_date_formats_form($form, &$form_state, $dfid = 0) { ), ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['update'] = array( '#type' => 'submit', '#value' => ($dfid ? t('Save format') : t('Add format')), @@ -2906,7 +2908,7 @@ function system_actions_manage_form($form, &$form_state, $options = array()) { '#options' => $options, '#description' => '', ); - $form['parent']['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['parent']['actions'] = array('#type' => 'actions'); $form['parent']['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Create'), @@ -3003,7 +3005,7 @@ function system_actions_configure($form, &$form_state, $action = NULL) { '#type' => 'hidden', '#value' => '1', ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/system/system.module b/modules/system/system.module index 1e526fcb0..a33807dfd 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -472,6 +472,11 @@ function system_element_info() { '#theme_wrappers' => array('container'), '#process' => array('form_process_container'), ); + $types['actions'] = array( + '#theme_wrappers' => array('container'), + '#process' => array('form_process_actions', 'form_process_container'), + '#weight' => 100, + ); $types['token'] = array( '#input' => TRUE, @@ -2575,9 +2580,7 @@ function _system_settings_form_automatic_defaults($form) { * @ingroup forms */ function system_settings_form($form, $automatic_defaults = TRUE) { - $form['actions']['#type'] = 'container'; - $form['actions']['#attributes']['class'][] = 'form-actions'; - $form['actions']['#weight'] = 100; + $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration')); if ($automatic_defaults) { @@ -2690,8 +2693,8 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, $form[$name] = array('#type' => 'hidden', '#value' => 1); $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions', 'container-inline')), + '#type' => 'actions', + '#attributes' => array('class' => array('container-inline')), ); $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm')); $form['actions']['cancel'] = array('#markup' => $cancel); diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index b8b6b3b5f..5cdc22b51 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -28,7 +28,8 @@ function taxonomy_overview_vocabularies($form) { // Only make this form include a submit button and weight if more than one // vocabulary exists. if (count($vocabularies) > 1) { - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); } elseif (isset($vocabulary)) { unset($form[$vocabulary->vid]['weight']); @@ -84,7 +85,7 @@ function theme_taxonomy_overview_vocabularies($variables) { } $header = array(t('Vocabulary name')); - if (isset($form['submit'])) { + if (isset($form['actions'])) { $header[] = t('Weight'); drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight'); } @@ -158,9 +159,10 @@ function taxonomy_form_vocabulary($form, &$form_state, $edit = array()) { '#value' => '0', ); - $form['submit'] = array('#type' => 'submit', '#value' => t('Save')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save')); if (isset($edit['vid'])) { - $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); + $form['actions']['delete'] = array('#type' => 'submit', '#value' => t('Delete')); $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']); $form['module'] = array('#type' => 'value', '#value' => $edit['module']); } @@ -385,11 +387,12 @@ function taxonomy_overview_terms($form, &$form_state, $vocabulary) { $form['#empty_text'] = t('No terms available. <a href="@link">Add term</a>.', array('@link' => url('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add'))); if ($vocabulary->hierarchy < 2 && count($tree) > 1) { - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions', '#tree' => FALSE); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save') ); - $form['reset_alphabetical'] = array( + $form['actions']['reset_alphabetical'] = array( '#type' => 'submit', '#value' => t('Reset to alphabetical') ); @@ -728,11 +731,7 @@ function taxonomy_form_term($form, &$form_state, $edit = array(), $vocabulary = '#value' => $edit['tid'], ); - $form['actions'] = array( - '#type' => 'container', - '#attributes' => array('class' => array('form-actions')), - '#weight' => 100, - ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc index 415a4c3a7..48f88d07e 100644 --- a/modules/update/update.manager.inc +++ b/modules/update/update.manager.inc @@ -230,10 +230,10 @@ function update_manager_update_form($form, $form_state = array(), $context) { // If either table has been printed yet, we need a submit button and to // validate the checkboxes. if (!empty($projects['enabled']) || !empty($projects['disabled'])) { - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Download these updates'), - '#weight' => 10, ); $form['#validate'][] = 'update_manager_update_form_validate'; } @@ -245,7 +245,7 @@ function update_manager_update_form($form, $form_state = array(), $context) { '#type' => 'markup', '#markup' => theme('table', array('header' => $headers, 'rows' => $projects['manual'])), '#prefix' => $prefix, - '#weight' => 20, + '#weight' => 120, ); } @@ -365,10 +365,10 @@ function update_manager_update_ready_form($form, &$form_state) { '#default_value' => TRUE, ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Continue'), - '#weight' => 100, ); return $form; @@ -491,7 +491,8 @@ function update_manager_install_form($form, &$form_state, $context) { '#description' => t('For example: %filename from your local computer', array('%filename' => 'name.tar.gz')), ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Install'), ); diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 7d92b7484..b0970019b 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -73,9 +73,9 @@ function user_filter_form() { } $form['filters']['actions'] = array( - '#type' => 'container', + '#type' => 'actions', '#id' => 'user-admin-buttons', - '#attributes' => array('class' => array('form-actions', 'container-inline')), + '#attributes' => array('class' => array('container-inline')), ); $form['filters']['actions']['submit'] = array( '#type' => 'submit', @@ -708,7 +708,7 @@ function user_admin_permissions($form, $form_state, $rid = NULL) { $form['role_names'][$rid] = array('#markup' => check_plain($name), '#tree' => TRUE); } - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save permissions')); $form['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.permissions.js'; @@ -844,7 +844,8 @@ function user_admin_roles($form, $form_state) { '#validate' => array('user_admin_role_validate'), '#submit' => array('user_admin_role_submit'), ); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save order'), '#submit' => array('user_admin_roles_order_submit'), @@ -934,7 +935,7 @@ function user_admin_role($form, $form_state, $role) { '#type' => 'value', '#value' => $role->weight, ); - $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save role'), diff --git a/modules/user/user.module b/modules/user/user.module index 063704054..9124d4762 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -1165,7 +1165,8 @@ function user_login_block($form) { '#size' => 15, '#required' => TRUE, ); - $form['submit'] = array('#type' => 'submit', + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in'), ); $items = array(); @@ -1829,7 +1830,8 @@ function user_login($form, &$form_state) { '#required' => TRUE, ); $form['#validate'] = user_login_default_validators(); - $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in')); return $form; } @@ -3357,10 +3359,10 @@ function user_register_form($form, &$form_state) { $form_state['redirect'] = $_GET['q']; } - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Create new account'), - '#weight' => 30, ); // Add the final user registration form submit handler. diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc index 1a5dfe227..74d508644 100644 --- a/modules/user/user.pages.inc +++ b/modules/user/user.pages.inc @@ -48,7 +48,8 @@ function user_pass() { '#suffix' => '</p>', ); } - $form['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('E-mail new password')); return $form; } @@ -140,7 +141,8 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a else { $form['message'] = array('#markup' => t('<p>This is a one-time login for %user_name and will expire on %expiration_date.</p><p>Click on this button to log in to the site and change your password.</p>', array('%user_name' => $account->name, '%expiration_date' => format_date($timestamp + $timeout)))); $form['help'] = array('#markup' => '<p>' . t('This login can be used only once.') . '</p>'); - $form['submit'] = array('#type' => 'submit', '#value' => t('Log in')); + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Log in')); $form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login"); return $form; } @@ -251,16 +253,15 @@ function user_profile_form($form, &$form_state, $account, $category = 'account') // Attach field widgets. field_attach_form('user', $account, $form, $form_state); - $form['submit'] = array( + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save'), - '#weight' => 30, ); if ($category == 'account') { - $form['cancel'] = array( + $form['actions']['cancel'] = array( '#type' => 'submit', '#value' => t('Cancel account'), - '#weight' => 31, '#submit' => array('user_edit_cancel_submit'), '#access' => $account->uid > 1 && (($account->uid == $user->uid && user_access('cancel account')) || user_access('administer users')), ); |