- @admitriiev opened merge request.
- ๐ฉ๐ชGermany a.dmitriiev
Uploading patch to use in Drupal CMS for config actions on views, that need to add/remove/update filters/fields and other options of the display.
- ๐ฉ๐ชGermany a.dmitriiev
The MR contains 3 new config actions for view entity type:
1.
setDisplayOption
- allows to set a display option like filters, fields, pager, etc .
Parameters:
option
(required) - the name of the option to manage, can be filters, fields, pager, etc (any option that view display can have)
settings
(required) - the option settings. This varies from option type.
display_id
(optional) - the display id, if non is provided the default is used.
Example usage:view.view.my_view: setDisplayOption: display_id: default option: pager settings: type: mini options: offset: 0 pagination_heading_level: h4 items_per_page: 10 total_pages: null id: 0 tags: next: โบโบ previous: โนโน expose: items_per_page: false items_per_page_label: 'Items per page' items_per_page_options: '5, 10, 25, 50' items_per_page_options_all: false items_per_page_options_all_label: '- All -' offset: false offset_label: Offset
2.
addItemToDisplayOption
allows to add the item to views display option. The difference fromsetDisplayOption
is that the existing option settings are preserved and only the new item is added to the option settings.
Parameters:
The same as forsetDisplayOption
, plus one moreitem
- for the name of the item to add.
Example usage:views.view.drupal_cms_search: addItemToDisplayOption: display_id: default option: filters item: facets_type settings: id: facets_type table: search_api_index_drupal_cms field: facets_type relationship: none group_type: group admin_label: '' plugin_id: facets_filter operator: '=' value: '' group: 1 exposed: true expose: operator_id: '' label: 'Content type' description: '' use_operator: false operator: '' operator_limit_selection: false operator_list: { } identifier: type required: false multiple: true remember_roles: authenticated: authenticated is_grouped: false group_info: label: '' description: '' identifier: '' optional: true widget: select multiple: false remember: false default_group: All default_group_multiple: { } group_items: { } hierarchy: false label_display: visible facet: query_operator: or min_count: 1 show_numbers: true processor_configs: translate_entity: weights: build: 5 settings: { }
3.
removeItemFromDisplayOption
allows to remove the item from views display option.
Parameters:
The same as foraddItemToDisplayOption
, minus onesettings
as it is not needed for item that is removed.
Example usage:views.view.drupal_cms_search: removeItemFromDisplayOption: display_id: default option: filters item: facets_type
- ๐ฉ๐ชGermany a.dmitriiev
I have also exposed 2 methods from view entity class:
addDisplay
andduplicateDisplayAsType
as Action Methods to use as config actions. The Needs Review Queue Bot โ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- ๐ฉ๐ชGermany a.dmitriiev
There are some tests with blocks that are failing, I assume not related to the tests form MR.
- ๐ฎ๐ณIndia nmudgal
Looks like it was just a fluke. Rerunning the pipeline resolved the failing test issue.