summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 03:15:41 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 03:15:41 +0000
commit28aaa036e471a5d96be3938545c49e2dc71e342e (patch)
tree9fa1fe8e8ecd6cff16f15204a016faa4c92b0011 /modules
parent2feffc2d61bf8b022f28e51dbea313602706661d (diff)
downloadbrdo-28aaa036e471a5d96be3938545c49e2dc71e342e.tar.gz
brdo-28aaa036e471a5d96be3938545c49e2dc71e342e.tar.bz2
#304330 follow-up by sun: Clean-up of text format widget patch.
Diffstat (limited to 'modules')
-rw-r--r--modules/filter/filter.css37
-rw-r--r--modules/filter/filter.module66
-rw-r--r--modules/node/node.css34
3 files changed, 72 insertions, 65 deletions
diff --git a/modules/filter/filter.css b/modules/filter/filter.css
new file mode 100644
index 000000000..a26ddae68
--- /dev/null
+++ b/modules/filter/filter.css
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+.text-format-wrapper .form-item {
+ margin-bottom: 0;
+}
+.filter-wrapper {
+ border-top: 0;
+ width: 95%;
+ margin: 0;
+ padding: 1.5em 0 1.5em;
+}
+.filter-wrapper .form-item {
+ float: left;
+ margin: 0;
+ padding: 0 0 0.5em 1.5em;
+}
+.filter-wrapper .form-item label {
+ display: inline;
+}
+.filter-help {
+ float: right;
+ padding: 0 1.5em 0.5em;
+}
+.filter-help p {
+ margin: 0;
+}
+.filter-help a {
+ background: transparent url(../../misc/help.png) right center no-repeat;
+ padding-right: 20px;
+}
+.filter-guidelines {
+ clear: left;
+ padding: 0 1.5em;
+}
+.text-format-wrapper .description {
+ margin-top: 0.5em;
+}
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 0fe072bd5..632847477 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -484,40 +484,44 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $langcode = '', $c
function filter_form($value = FILTER_FORMAT_DEFAULT, $weight = NULL, $parents = array('format')) {
$value = filter_resolve_format($value);
$formats = filter_formats();
-
+
+ drupal_add_js('misc/form.js');
+ drupal_add_css(drupal_get_path('module', 'filter') . '/filter.css');
+ $element_id = form_clean_id('edit-' . implode('-', $parents));
+
$form = array(
- '#type' => 'fieldset',
- '#weight' => $weight,
- '#attributes' => array('class' => 'filter-wrapper'),
+ '#type' => 'fieldset',
+ '#weight' => $weight,
+ '#attributes' => array('class' => 'filter-wrapper'),
);
-
- $element_id = form_clean_id('edit-' . implode('-', $parents));
-
- if (count($formats) > 1) {
- foreach ($formats as $format) {
- $options[$format->format] = $format->name;
- $guidelines[$format->format] = array('#markup' => theme('filter_guidelines', $format));
- }
- drupal_add_js('misc/form.js');
- $form['format'] = array(
- '#type' => 'select',
- '#title' => t('Text format'),
- '#options' => $options,
- '#default_value' => $value,
- '#parents' => $parents,
- '#id' => $element_id,
- '#attributes' => array('class' => 'filter-list'),
+ $form['format_guidelines'] = array(
+ '#prefix' => '<div id="' . $element_id . '-guidelines" class="filter-guidelines">',
+ '#suffix' => '</div>',
+ '#weight' => 2,
+ );
+ foreach ($formats as $format) {
+ $options[$format->format] = $format->name;
+ $form['format_guidelines'][$format->format] = array(
+ '#markup' => theme('filter_guidelines', $format),
);
}
- else {
- // Only one format available: use a form value and only show label.
- $format = array_shift($formats);
- unset($format->name);
- $guidelines = array('#markup' => theme('filter_guidelines', $format));
- $form[$format->format] = array('#type' => 'value', '#value' => $format->format, '#parents' => $parents);
- }
- $form['format_help'] = array('#markup' => '<div id="' . $element_id . '-help" class="filter-help">' . theme('filter_tips_more_info') . '</div>');
- $form['format_guidelines'] = array_merge($guidelines, array('#prefix' => '<div id="' . $element_id . '-guidelines" class="filter-guidelines">', '#suffix' => '</div>'));
+ $form['format'] = array(
+ '#type' => 'select',
+ '#title' => t('Text format'),
+ '#options' => $options,
+ '#default_value' => $value,
+ '#parents' => $parents,
+ '#access' => count($formats) > 1,
+ '#id' => $element_id,
+ '#attributes' => array('class' => 'filter-list'),
+ );
+ $form['format_help'] = array(
+ '#prefix' => '<div id="' . $element_id . '-help" class="filter-help">',
+ '#markup' => theme('filter_tips_more_info'),
+ '#suffix' => '</div>',
+ '#weight' => 1,
+ );
+
return $form;
}
@@ -583,7 +587,7 @@ function theme_filter_tips_more_info() {
* @ingroup themeable
*/
function theme_filter_guidelines($format) {
- $name = isset($format->name) ? '<label>' . $format->name . ':</label>' : NULL;
+ $name = isset($format->name) ? '<label>' . $format->name . ':</label>' : '';
return '<div id="filter-guidelines-' . $format->format . '" class="filter-guidelines-item">' . $name . theme('filter_tips', _filter_tips($format->format, FALSE)) . '</div>';
}
diff --git a/modules/node/node.css b/modules/node/node.css
index 58ed30862..ab5a6a18b 100644
--- a/modules/node/node.css
+++ b/modules/node/node.css
@@ -42,38 +42,4 @@ td.revision-current {
.terms-inline {
display: inline;
}
-.filter-label {
- font-weight: bold;
-}
-
-.filter-wrapper {
- border-top: 0;
- width: 95%;
- padding: 0;
- margin-top: -1em;
- float: left; /* Required by IE6 to respect negative margins */
-}
-.filter-guidelines {
- clear: left;
- margin: 1.5em;
-}
-.filter-wrapper .form-item {
- float: left;
- line-height: 3em;
- margin: 0 0 0 1.5em;
-}
-.filter-wrapper .form-item label {
- display: inline;
-}
-.filter-help {
- float: right;
- margin-right: 1em;
-}
-.filter-help a {
- background: url(../../misc/help.png) right center no-repeat;
- padding-right: 20px;
-}
-html.js fieldset.collapsible {
- clear: left; /* Test fix for Safari issues caused by IE6 fix above, need to test impact elsewhere and move to appropriate CSS file */
-} \ No newline at end of file