localgovdrupal / localgov_finders

LocalGov Finders (will) help Directories, Events, News, Consultations etc. display, index, and filter their content.
GNU General Public License v2.0
0 stars 0 forks source link

view mode setup #20

Closed joachim-n closed 2 days ago

joachim-n commented 1 week ago

In Directories, the view mode search_result is installed from config -- config/install/core.entity_view_display.node.localgov_directory.search_result.yml.

If Finders base module is entity type-agnostic, we probably need to make that config installed from a template?

ekes commented 1 week ago

If I recall Directories doesn't create a display mode for new entry types. So this is something we want to extend anyway. How much this could be some template yml, how much needs to be code - because of unknown, or potentially missing, fields I'm not sure. I suspect we can just do our best, enabling the view mode.

Question: is the only view mode going to be the search input / output ones? I guess so. But could potentially be more than one.

joachim-n commented 1 week ago

If I recall Directories doesn't create a display mode for new entry types

Yeah, I think I filed a bug report about that!

joachim-n commented 1 week ago

Also, I'm confused about this in ConfigurationHelper:

  protected function viewSetViewMode(ViewEntityInterface $view, string $entity_type_id, string $entity_bundle): void {
    // Also set the default view mode for the directory view listing.
    $display = $view->get('display');
    if (isset($display['node_embed']['display_options']['row'])) {
      $display['node_embed']['display_options']['row']['options']['view_modes']['entity:' . $entity_type_id][$entity_bundle] = 'teaser';
    }

It's setting the view mode to teaser, but the module provides search_result view displays in config/install. Is that just because it's creating view displays for all the core view modes?

willguv commented 4 days ago

Two view modes:

joachim-n commented 2 days ago

Done.