Open bserem opened 7 years ago
This is totally possible, it's about building yet another Views plugin (a display plugin in this case) that would use patterns to format the view.
BTW: since patterns are exposed as layouts too have you tried using something along the line of https://www.drupal.org/project/layout_plugin_views ?
I didn't knew about layout_plugin_views, but it seems pretty old for D8 standards.
Anyway, I am giving a try for a views plugin right right now.
Yep, have a look, if not then we can just add it to UI Patterns, it's totally in the scope of the core module.
FYI - since you'll probably hit these when installing layout_plugin_views (since it depends on layout_plugin), here is a layout_plugin patch: https://www.drupal.org/project/layout_plugin/issues/2871585
Error: Cannot use object of type Drupal\Core\Layout\LayoutDefinition as array in Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager->getThemeImplementations() (line 162 of modules/contrib/layout_plugin/src/Plugin/Layout/LayoutPluginManager.php).
Would be great to have deeper support/control for Views:
This would require additional metadata in pattern definition (Accordion have panes, each pane have header and body) - kind of substructures.
I wrote a custom views plugin style for that:
The settings
It would ideal to have support to style the whole view using UI patterns.
I know that we can use views for the row styling, which is pretty amazing. What I would like to see on top of that is the option to select patterns as the view format (alongside 'unformatted/html list', 'table' and 'grid').
I'll try to describe my thoughts giving an example, in order to make things easier to understand.
Lets say I have a pattern called
card
with fieldsimage, title, content, action
and a twig like:This works fine as a row plugin with ui_patterns.
Now, I have an extra pattern, called
cards
with one field, namedcard
and a twig file with something like the following:This way, I can pre-style my views in ui_patterns, and then assign the pattern to the view and have the expected output (see: https://www.drupal.org/files/project-images/components_combo.png)
Do you believe something like that is possible? Does it make sense to anybody else?
Hope I explained it well