It does not seem to work. I altered some stuff and i can see /chose on the field display settings of a content type. BUT it does not appear if i select the formatter in views.

Comments

dave reid’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev

Yep, this is something I'd like to solve before 7.x-1.0 official release.

henrijs.seso’s picture

Indeed. Also panels support.

yannickoo’s picture

Dave what's going on here? Do you will fix that next time?

spacegoat1701’s picture

StatusFileSize
new1.22 KB

I've added Views functionality to my installation. Attached is a patch generated by phpStorm.

Please note that this is untested aside from implementing Views integration with my installation of Responsive images and styles 2: http://drupal.org/project/resp_img

yannickoo’s picture

Status: Active » Needs work
StatusFileSize
new882 bytes

I attached a better version of this patch (can be applied with git apply field_formatter_settings-views_integration-1439838-5.patch) but after applying the patch and clearing the caches I even don't get the field formatter settings :(

tobiasb’s picture

Status: Needs work » Needs review
yannickoo’s picture

Status: Needs review » Needs work

My patch is just another version of the patch in #4 so "needs work" is the right status.

yannickoo’s picture

Status: Needs work » Needs review
spacegoat1701’s picture

Status: Needs review » Needs work

I've been checking with my own installation, and it's working fine for me on all the Views fields I've checked.

I did tweak the function a bit, though, to prevent some watchdog messages I was receiving:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function field_formatter_settings_form_views_ui_config_item_form_alter(&$form, &$form_state) {
  if ($handler = $form_state['handler']) {
    if (isset($form['options']) && isset($handler->field_info['module']) && isset($handler->field_info['type']) && isset($handler->options['field'])) {
      $context = array(
        'module' => $handler->field_info['module'],
        'field' => field_info_field($handler->options['field']),
        'formatter' => $handler->field_info['type'],
        'form' => $form,
        'form_state' => $form_state,
      );
      drupal_alter('field_formatter_settings_form', $form['options']['settings'], $context);
    }
  }
}

I'm using Drupal 7.15, Views 7.x-3.3, and Field Formatter Settings 7.x-1.x-dev from June 28, 2011.

If you're using those versions, I don't know why it's not working for you. Maybe try my tweaked function. If that still doesn't work, check your watchdog and server logs for errors; maybe those could help.

I should note that I don't have a lot of time to provide support now. I just wanted to share what I had made work on my own install.

yannickoo’s picture

StatusFileSize
new64.78 KB

Strange, have the same versions installed. Could you show me the form the settings and the context variable via:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function field_formatter_settings_form_views_ui_config_item_form_alter(&$form, &$form_state) {
  $handler = $form_state['handler'];
  if (isset($form['options'])) {
    $context = array(
      'module' => $handler->field_info['module'],
      'field' => field_info_field($handler->options['field']),
      'formatter' => $handler->field_info['type'],
      'form' => $form,
      'form_state' => $form_state,
    );
    dpm($form['options']['settings'], 'settings');
    dpm($context, 'context');
    drupal_alter('field_formatter_settings_form', $form['options']['settings'], $context);
  }
}

For plain text field formatter I get following dpm's:
Screen Shot 2012-08-09 at 15.03.20.png

spacegoat1701’s picture

For an image field, dpm($form['options']['settings'], 'settings'); yields (on my setup, the area in which the devel output rendered was too small for a screenshot to be useful, and I couldn't resize):

... (Array, 2 elements)
image_style (Array, 5 elements)
image_link (Array, 5 elements)

dpm($context, 'context'); yields:

... (Array, 5 elements)
module (String, 5 characters ) image
field (Array, 16 elements)
formatter (String, 5 characters ) image
form (Array, 23 elements)
form_state (Array, 27 elements)

For a taxonomy reference field, settings:

... (Array, 5 elements)
textformatter_link (Array, 4 elements)
textformatter_skip (Array, 5 elements)
textformatter_and (Array, 4 elements)
textformatter_period (Array, 4 elements)
textformatter_rdf (Array, 5 elements)

Context:

... (Array, 5 elements)
module (String, 8 characters ) taxonomy
field (Array, 16 elements)
formatter (String, 23 characters ) taxonomy_term_reference
form (Array, 23 elements)
form_state (Array, 27 elements)

Date field, settings:

... (Array, 6 elements)
format_type (Array, 6 elements)
fromto (Array, 6 elements)
multiple_number (Array, 9 elements)
multiple_from (Array, 7 elements)
multiple_to (Array, 8 elements)
show_repeat_rule (Array, 6 elements)

Context:

... (Array, 5 elements)
module (String, 4 characters ) date | (Callback) date();
field (Array, 16 elements)
formatter (String, 8 characters ) datetime
form (Array, 23 elements)
form_state (Array, 27 elements)

yannickoo’s picture

Status: Needs work » Needs review
StatusFileSize
new39.65 KB
new1012 bytes

So I patched views and based on the posted patch #1741216: Views handler doesn't store the field instance in the object, so it's hard to reuse we can patch this module so that we finally have views integration!

Screen Shot 2012-08-20 at 17.40.39.png

yannickoo’s picture

Changed the _dummy view mode to _custom like in the field_view_field function.

yannickoo’s picture

dave reid’s picture

Status: Needs review » Fixed

Tested and committed #13 to 7.x-1.x with some small tweaks (use instanceof rather than get_class(), added docs). Thanks everyone!
http://drupalcode.org/project/field_formatter_settings.git/commit/7c2b0cd

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

yannickoo’s picture

Status: Closed (fixed) » Needs work

It's so sad to reopen this issue but I think you can set the field formatter settings in views but we don't do anything with displaying it correctly right? I don't think that we call hook_field_attach_view_alter.

I got an issue #1799350: Field is empty when displaying via views module with this bug and was confused because we fixed that here but that was only the settings stuff and not the display thing.

yannickoo’s picture

Status: Needs work » Closed (fixed)

After lot of debugging I can confirm that this isn't a Field formatter settings issue. The problem is in hook_field_attach_view_alter, sorry for reopening.