Commit 1326a44a authored by catch's avatar catch

Issue #1269734 by Everett Zufelt, sun, Jacine: Add form name class to forms for styling purposes.

parent f373703b
......@@ -762,6 +762,15 @@ function drupal_retrieve_form($form_id, &$form_state) {
}
$form = array();
// Assign a default CSS class name based on $form_id.
// This happens here and not in drupal_prepare_form() in order to allow the
// form constructor function to override or remove the default class.
$form['#attributes']['class'][] = drupal_html_class($form_id);
// Same for the base form ID, if any.
if (isset($form_state['build_info']['base_form_id'])) {
$form['#attributes']['class'][] = drupal_html_class($form_state['build_info']['base_form_id']);
}
// We need to pass $form_state by reference in order for forms to modify it,
// since call_user_func_array() requires that referenced variables are passed
// explicitly.
......
......@@ -1858,7 +1858,6 @@ function comment_form($form, &$form_state, $comment) {
// Use #comment-form as unique jump target, regardless of node type.
$form['#id'] = drupal_html_id('comment_form');
$form['#attributes']['class'][] = 'comment-form';
$form['#theme'] = array('comment_form__node_' . $node->type, 'comment_form');
$anonymous_contact = variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT);
......
......@@ -110,10 +110,9 @@ function node_form($form, &$form_state, $node) {
// @todo D8: Remove. Modules can implement hook_form_BASE_FORM_ID_alter() now.
$form['#node_edit_form'] = TRUE;
$form['#attributes']['class'][] = 'node-form';
if (!empty($node->type)) {
$form['#attributes']['class'][] = 'node-' . $node->type . '-form';
}
// Override the default CSS class name, since the user-defined node type name
// in 'TYPE-node-form' potentially clashes with third-party class names.
$form['#attributes']['class'][0] = drupal_html_class('node-' . $node->type . '-form');
// Basic node information.
// These elements are just values so they are not even sent to the client.
......
......@@ -987,7 +987,6 @@ function search_form($form, &$form_state, $action = '', $keys = '', $module = NU
$form['#action'] = url($action);
// Record the $action for later use in redirecting.
$form_state['action'] = $action;
$form['#attributes']['class'][] = 'search-form';
$form['module'] = array('#type' => 'value', '#value' => $module);
$form['basic'] = array('#type' => 'container', '#attributes' => array('class' => array('container-inline')));
$form['basic']['keys'] = array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment