#414424 follow-up by sun: Minor follow-ups to text_format patch.
parent
56e60eb06f
commit
be78796ff2
|
@ -11,8 +11,8 @@ Drupal.behaviors.textSummary = {
|
|||
var $widget = $(this).closest('div.field-type-text-with-summary');
|
||||
var $summary = $widget.find('div.text-summary-wrapper');
|
||||
var $summaryLabel = $summary.find('label');
|
||||
var $full = $widget.find('div.text-full-wrapper');
|
||||
var $fullLabel = $full.find('div.form-type-textarea label');
|
||||
var $full = $widget.find('.form-item:has(.text-full)');
|
||||
var $fullLabel = $full.find('label');
|
||||
|
||||
// Setup the edit/hide summary link.
|
||||
var $link = $('<span class="field-edit-link">(<a class="link-edit-summary" href="#">' + Drupal.t('Hide summary') + '</a>)</span>').toggle(
|
||||
|
|
|
@ -521,8 +521,7 @@ function text_field_widget_form(&$form, &$form_state, $field, $instance, $langco
|
|||
'#type' => 'textfield',
|
||||
'#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
|
||||
'#size' => $instance['widget']['settings']['size'],
|
||||
'#prefix' => '<div class="text-full-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
'#attributes' => array('class' => array('text-full')),
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -549,8 +548,7 @@ function text_field_widget_form(&$form, &$form_state, $field, $instance, $langco
|
|||
'#type' => 'textarea',
|
||||
'#default_value' => isset($items[$delta]['value']) ? $items[$delta]['value'] : NULL,
|
||||
'#rows' => $instance['widget']['settings']['rows'],
|
||||
'#prefix' => '<div class="text-full-wrapper">',
|
||||
'#suffix' => '</div>',
|
||||
'#attributes' => array('class' => array('text-full')),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -746,8 +746,9 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE)
|
|||
* If multiple text format-enabled elements are required on the same level of
|
||||
* the form structure, modules can set custom #parents on the original element.
|
||||
* Alternatively, the #after_build may be unset through a subsequent #process
|
||||
* callback. If no custom processing occurs, then the submitted form values will
|
||||
* appear like in the $form_state['input'] array above.
|
||||
* callback. If the default #after_build is not invoked and no custom processing
|
||||
* occurs, then the submitted form values will appear like in the
|
||||
* $form_state['input'] array above.
|
||||
*
|
||||
* @see filter_form_after_build()
|
||||
*
|
||||
|
@ -785,11 +786,11 @@ function filter_process_format($element) {
|
|||
'#processed',
|
||||
'#theme_wrappers',
|
||||
);
|
||||
// Move this element into sub-element 'value'.
|
||||
// Move this element into sub-element 'value'.
|
||||
unset($element['value']);
|
||||
foreach ($element as $key => $value) {
|
||||
if ($key[0] === '#' && !in_array($key, $blacklist)) {
|
||||
$element['value'][$key] = $value;
|
||||
foreach (element_properties($element) as $key) {
|
||||
if (!in_array($key, $blacklist)) {
|
||||
$element['value'][$key] = $element[$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,7 +840,6 @@ function filter_process_format($element) {
|
|||
'#weight' => 10,
|
||||
'#attributes' => array('class' => array('filter-list')),
|
||||
'#parents' => array_merge($element['#parents'], array('format')),
|
||||
'#value_callback' => 'filter_form_value_callback_format',
|
||||
);
|
||||
|
||||
$element['format']['help'] = array(
|
||||
|
@ -853,23 +853,24 @@ function filter_process_format($element) {
|
|||
}
|
||||
|
||||
/**
|
||||
* After build, we need to move the values up in $form_state.
|
||||
* After build callback to move #type 'text_format' values up in $form_state.
|
||||
*/
|
||||
function filter_form_after_build($element, &$form_state) {
|
||||
$parents = $element['#parents'];
|
||||
$original_key = array_pop($parents);
|
||||
|
||||
// For text fields, the additional subkeys map 1:1 to field schema columns.
|
||||
if (isset($element['#columns'])) {
|
||||
return $element;
|
||||
}
|
||||
|
||||
$parents = $element['#parents'];
|
||||
array_pop($parents);
|
||||
|
||||
foreach (element_children($element) as $key) {
|
||||
$current_parents = $parents;
|
||||
switch ($key) {
|
||||
case 'value':
|
||||
form_set_value(array('#parents' => $element['#parents']), $element[$key]['#value'], $form_state);
|
||||
break;
|
||||
|
||||
case 'format':
|
||||
$current_parents[] = $key;
|
||||
form_set_value(array('#parents' => $current_parents), $element['format']['format']['#value'], $form_state);
|
||||
|
|
Loading…
Reference in New Issue