summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-09-27 20:37:01 +0000
committerDries Buytaert <dries@buytaert.net>2008-09-27 20:37:01 +0000
commit9f3d9f11158aec709dac7d67b99ff6fd8c2c634d (patch)
tree68fc762cb0dd1bdb7b86483c4e12be6aa69dcabc /modules
parent0d84b9184948372469480fa32daab66d37c95df6 (diff)
downloadbrdo-9f3d9f11158aec709dac7d67b99ff6fd8c2c634d.tar.gz
brdo-9f3d9f11158aec709dac7d67b99ff6fd8c2c634d.tar.bz2
- Patch #161301 by Eaton, Sun, moshe and webchick: make checking for node edit forms easier. DX improvement.
Diffstat (limited to 'modules')
-rw-r--r--modules/book/book.module2
-rw-r--r--modules/comment/comment.module34
-rw-r--r--modules/menu/menu.module2
-rw-r--r--modules/node/node.pages.inc3
-rw-r--r--modules/path/path.module2
-rw-r--r--modules/taxonomy/taxonomy.module2
-rw-r--r--modules/upload/upload.module4
7 files changed, 24 insertions, 25 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index 81bdb41b3..551a8db2a 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -295,7 +295,7 @@ function book_get_books() {
*/
function book_form_alter(&$form, $form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
+ if (!empty($form['#node_edit_form'])) {
// Add elements to the node form.
$node = $form['#node'];
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index f1af2b608..80e9aad2f 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -532,24 +532,22 @@ function comment_form_alter(&$form, $form_state, $form_id) {
'#options' => array(t('Display on separate page'), t('Display below post or comments')),
);
}
- elseif (isset($form['type']) && isset($form['#node'])) {
- if ($form['type']['#value'] . '_node_form' == $form_id) {
- $node = $form['#node'];
- $form['comment_settings'] = array(
- '#type' => 'fieldset',
- '#access' => user_access('administer comments'),
- '#title' => t('Comment settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#weight' => 30,
- );
- $form['comment_settings']['comment'] = array(
- '#type' => 'radios',
- '#parents' => array('comment'),
- '#default_value' => $node->comment,
- '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')),
- );
- }
+ elseif (!empty($form['#node_edit_form'])) {
+ $node = $form['#node'];
+ $form['comment_settings'] = array(
+ '#type' => 'fieldset',
+ '#access' => user_access('administer comments'),
+ '#title' => t('Comment settings'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#weight' => 30,
+ );
+ $form['comment_settings']['comment'] = array(
+ '#type' => 'radios',
+ '#parents' => array('comment'),
+ '#default_value' => $node->comment,
+ '#options' => array(t('Disabled'), t('Read only'), t('Read/Write')),
+ );
}
}
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 03406735c..f3fb6e8b2 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -350,7 +350,7 @@ function _menu_parent_depth_limit($item) {
* Implementation of hook_form_alter(). Adds menu item fields to the node form.
*/
function menu_form_alter(&$form, $form_state, $form_id) {
- if (isset($form['#node']) && $form['#node']->type . '_node_form' == $form_id) {
+ if (!empty($form['#node_edit_form'])) {
// Note - doing this to make sure the delete checkbox stays in the form.
$form['#cache'] = TRUE;
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index 6f48a74ab..1194e320f 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -117,8 +117,9 @@ function node_form(&$form_state, $node) {
$node->build_mode = NODE_BUILD_PREVIEW;
}
- // Set the id of the top-level form tag
+ // Set the id and identify this as a node edit form.
$form['#id'] = 'node-form';
+ $form['#node_edit_form'] = TRUE;
// Basic node information.
// These elements are just values so they are not even sent to the client.
diff --git a/modules/path/path.module b/modules/path/path.module
index f4cb039c2..e3eaa8de4 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -172,7 +172,7 @@ function path_nodeapi(&$node, $op, $arg) {
* Implementation of hook_form_alter().
*/
function path_form_alter(&$form, $form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
+ if (!empty($form['#node_edit_form'])) {
$path = isset($form['#node']->path) ? $form['#node']->path : NULL;
$form['path'] = array(
'#type' => 'fieldset',
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 438ddf0fe..be11c08c6 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -503,7 +503,7 @@ function taxonomy_get_vocabularies($type = NULL) {
* and provide scalable alternatives.
*/
function taxonomy_form_alter(&$form, $form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && (!variable_get('taxonomy_override_selector', FALSE)) && $form['type']['#value'] . '_node_form' == $form_id) {
+ if (!variable_get('taxonomy_override_selector', FALSE) && !empty($form['#node_edit_form'])) {
$node = $form['#node'];
if (!isset($node->taxonomy)) {
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 747bacb85..a2bfac99c 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -217,9 +217,9 @@ function upload_form_alter(&$form, $form_state, $form_id) {
);
}
- if (isset($form['type']) && isset($form['#node'])) {
+ if (!empty($form['#node_edit_form'])) {
$node = $form['#node'];
- if ($form['type']['#value'] . '_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) {
+ if (variable_get("upload_$node->type", TRUE)) {
// Attachments fieldset
$form['attachments'] = array(
'#type' => 'fieldset',