Issue #1875122 by dawehner, damiankloip: field formatter settings on views are lost.
parent
a5a24f70b7
commit
a6c11e9d4f
|
@ -385,17 +385,26 @@ class Field extends FieldPluginBase {
|
||||||
// Get the currently selected formatter.
|
// Get the currently selected formatter.
|
||||||
$format = $this->options['type'];
|
$format = $this->options['type'];
|
||||||
|
|
||||||
$formatter = field_info_formatter_types($format);
|
|
||||||
$settings = $this->options['settings'] + field_info_formatter_settings($format);
|
$settings = $this->options['settings'] + field_info_formatter_settings($format);
|
||||||
|
|
||||||
// Provide an instance array for hook_field_formatter_settings_form().
|
// Provide an instance array for hook_field_formatter_settings_form().
|
||||||
$this->instance = $this->fakeFieldInstance($format, $settings);
|
$this->instance = $this->fakeFieldInstance($format, $settings);
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
'instance' => $this->instance,
|
||||||
|
'configuration' => array(
|
||||||
|
'type' => $format,
|
||||||
|
'settings' => $settings,
|
||||||
|
'label' => '',
|
||||||
|
'weight' => 0,
|
||||||
|
),
|
||||||
|
'view_mode' => '_custom',
|
||||||
|
);
|
||||||
|
|
||||||
// Get the settings form.
|
// Get the settings form.
|
||||||
$settings_form = array('#value' => array());
|
$settings_form = array('#value' => array());
|
||||||
$function = $formatter['module'] . '_field_formatter_settings_form';
|
if ($formatter = drupal_container()->get('plugin.manager.field.formatter')->getInstance($options)) {
|
||||||
if (function_exists($function)) {
|
$settings_form = $formatter->settingsForm($form, $form_state);
|
||||||
$settings_form = $function($field, $this->instance, '_custom', $form, $form_state);
|
|
||||||
}
|
}
|
||||||
$form['settings'] = $settings_form;
|
$form['settings'] = $settings_form;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,10 @@ display:
|
||||||
field: nid
|
field: nid
|
||||||
id: nid
|
id: nid
|
||||||
table: node
|
table: node
|
||||||
|
field_name_0:
|
||||||
|
id: field_name_0
|
||||||
|
table: field_data_field_name_0
|
||||||
|
field: field_name_0
|
||||||
cache:
|
cache:
|
||||||
type: none
|
type: none
|
||||||
exposed_form:
|
exposed_form:
|
||||||
|
|
|
@ -1567,8 +1567,9 @@ function views_ui_config_item_form_submit_temporary($form, &$form_state) {
|
||||||
// extra stuff on the form is not sent through.
|
// extra stuff on the form is not sent through.
|
||||||
$handler->unpackOptions($handler->options, $options, NULL, FALSE);
|
$handler->unpackOptions($handler->options, $options, NULL, FALSE);
|
||||||
|
|
||||||
// Store the item back on the view
|
// Store the item back on the view.
|
||||||
$form_state['view']->temporary_options[$type][$form_state['id']] = $handler->options;
|
$executable = $form_state['view']->get('executable');
|
||||||
|
$executable->temporary_options[$type][$form_state['id']] = $handler->options;
|
||||||
|
|
||||||
// @todo: Figure out whether views_ui_ajax_form is perhaps the better place to fix the issue.
|
// @todo: Figure out whether views_ui_ajax_form is perhaps the better place to fix the issue.
|
||||||
// views_ui_ajax_form() drops the current form from the stack, even if it's an #ajax.
|
// views_ui_ajax_form() drops the current form from the stack, even if it's an #ajax.
|
||||||
|
|
Loading…
Reference in New Issue