Commit a6c11e9d authored by Dries's avatar Dries

Issue #1875122 by dawehner, damiankloip: field formatter settings on views are lost.

parent a5a24f70
......@@ -385,17 +385,26 @@ public function buildOptionsForm(&$form, &$form_state) {
// Get the currently selected formatter.
$format = $this->options['type'];
$formatter = field_info_formatter_types($format);
$settings = $this->options['settings'] + field_info_formatter_settings($format);
// Provide an instance array for hook_field_formatter_settings_form().
$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.
$settings_form = array('#value' => array());
$function = $formatter['module'] . '_field_formatter_settings_form';
if (function_exists($function)) {
$settings_form = $function($field, $this->instance, '_custom', $form, $form_state);
if ($formatter = drupal_container()->get('plugin.manager.field.formatter')->getInstance($options)) {
$settings_form = $formatter->settingsForm($form, $form_state);
}
$form['settings'] = $settings_form;
}
......
......@@ -13,6 +13,10 @@ display:
field: nid
id: nid
table: node
field_name_0:
id: field_name_0
table: field_data_field_name_0
field: field_name_0
cache:
type: none
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.
$handler->unpackOptions($handler->options, $options, NULL, FALSE);
// Store the item back on the view
$form_state['view']->temporary_options[$type][$form_state['id']] = $handler->options;
// Store the item back on the view.
$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.
// views_ui_ajax_form() drops the current form from the stack, even if it's an #ajax.
......
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