az-digital / az_quickstart

UArizona's web content management system built with Drupal 10.
https://quickstart.arizona.edu
GNU General Public License v2.0
30 stars 20 forks source link

Have content editor select expanded or collapsed by default on Quickstart Exposed Filters #3262

Closed danahertzberg closed 2 months ago

danahertzberg commented 6 months ago

Motivation

When using Quickstart Exposed Filters, I want to have an option to expand or collapse the item with children by default.

Proposed Resolution

Describe the solution you'd like

Ideally, this could be on the taxonomy term page. Something like the checkbox option of "Show as expanded" on the main nav menu items.

Example file: https://github.com/az-digital/az_quickstart/blob/main/themes/custom/az_barrio/templates/navigation/menu--az-utility-links.html.twig Example functionality: https://github.com/az-digital/az_quickstart/tree/main/modules/custom/az_accordion

In the view plugin itself add a fallback option for what to do when configuration is not set for a particular parent term. The options for fallback can be

expand
collapse

Requirements:

Describe alternatives you've considered

An alternative would be to put these term settings within the view settings page.

Additional context

This is a follow up to https://github.com/az-digital/az_quickstart/pull/2998

danahertzberg commented 6 months ago

Initial work to add the checkbox to the taxonomy term page.

modules/custom/az_core/config/install/core.entity_form_display.taxonomy_term.az_page_categories.default.yml

langcode: en
status: true
dependencies:
  config:
    - field.field.taxonomy_term.az_page_categories.field_collapsed_by_default
    - taxonomy.vocabulary.az_page_categories
  module:
    - path
    - text
id: taxonomy_term.az_page_categories.default
targetEntityType: taxonomy_term
bundle: az_page_categories
mode: default
content:
  description:
    type: text_textarea
    weight: 1
    region: content
    settings:
      rows: 5
      placeholder: ''
    third_party_settings: {  }
  field_collapsed_by_default:
    type: boolean_checkbox
    weight: 2
    region: content
    settings:
      display_label: true
    third_party_settings: {  }
  name:
    type: string_textfield
    weight: 0
    region: content
    settings:
      size: 60
      placeholder: ''
    third_party_settings: {  }
  path:
    type: path
    weight: 3
    region: content
    settings: {  }
    third_party_settings: {  }
  status:
    type: boolean_checkbox
    weight: 4
    region: content
    settings:
      display_label: true
    third_party_settings: {  }
hidden: {  }