When you currently install the module, the List field formatter doesn't show up on the view mode configuration form. This patch attempts to fix that, i.e.:

- It makes sure that all the list_formatter plugins have appropriate field_types set in their annotations.
- It filters out the language and path fields in the ListFormatter formatter plugin - there's probably a better/cleaner way to do this (not sure why they're showing up in the first place).
- It adds a config schema for the formatter configuration (see https://www.drupal.org/docs/8/creating-custom-modules/create-a-custom-fi..., under 'Formatter settings').

Pretty sure there is more to do, but with this patch applied, it looks like it's possible to use the list formatter again.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brunodbo created an issue. See original summary.

brunodbo’s picture

Status: Active » Needs review
FileSize
8.05 KB
brunodbo’s picture

Side note: I think that the language and path fields might also be causing the issue in #2862347: Clearing cache and installing modules causes field types to throw warnings. Somehow they end up in the plugin definitions, while they shouldn't.

brunodbo’s picture

Issue summary: View changes
brunodbo’s picture

A few more improvements:

- Separated out the list_formatter plugin loading in the formatter plugin to a separate method (getListFormatter()).
- I'm not using the taxonomy_term plugin (TaxonomyList.php) here anymore, since it looks like we can just use the entity_reference plugin (EntityReferenceList.php) for that. I left the taxonomy plugin in place for now though, as well as commented code which would load a separate plugin based on the target entity type. Perhaps we could extend the entity_reference plugin with support for view modes in its additional configuration method.

brunodbo’s picture

This fixes some things with the list_formatter contrib config.

brunodbo’s picture

Better patch.

brunodbo’s picture

FileSize
16.79 KB

Fixing another error that slipped in.

brunodbo’s picture

FileSize
16.75 KB

And removing some dev cruft.

brunodbo’s picture

This passes only the settings to list_formatter_theme(), since we don't need the full $formatter in there. This patch should be applied together with the latest one at #2942617: Replace 'list_formatter_comma' theme function with template.

brunodbo’s picture

This gets link fields working again with list_formatter.

brunodbo’s picture

Some tweaks to the way we get the $provider in getListFormatter(), in order to get option fields working again.

DuneBL’s picture

This is the patch that make this module working!

jhedstrom’s picture

FileSize
827 bytes
17.91 KB

This updates the patch in #12 to fix this exception that happens for text_long items.

Error: Cannot use object of type Drupal\text\Plugin\Field\FieldType\TextLongItem as array in Drupal\list_formatter\Plugin\list_formatter\TextList->createList() (line 33 of modules/contrib/list_formatter/src/Plugin/list_formatter/TextList.php).
fskreuz’s picture

Status: Needs review » Reviewed & tested by the community

Updated

  • _shY committed 0401ca5d on 8.x-2.x authored by jhedstrom
    Issue #2942348 by brunodbo, jhedstrom, DuneBL, fskreuz: Allow 'List'...
_shY’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, everyone for your work and time.
Patch #12 looks awesome, you did a great job!

Re-rolled the patch and made some minor changes.
Merged to 8.x-2.x-dev!

brunodbo’s picture

Glad to see this merged, thanks!

Status: Fixed » Closed (fixed)

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