Skip to content

Commit

Permalink
Merge pull request #156 from openeuropa/EPIC-1450-List-pages
Browse files Browse the repository at this point in the history
OEL-1450: Epic list pages.
  • Loading branch information
donquixote authored Jun 9, 2022
2 parents 3ff75d2 + 86b4e79 commit 18a4933
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 2 deletions.
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
"drupal/description_list_field": "^1.0@alpha",
"drupal/drupal-extension": "~4.1",
"drupal/entity_reference_revisions": "^1.9",
"drupal/extra_field": "^2.1",
"drupal/facets": "1.8.0 as 2.0.1",
"drupal/facets_form": "1.0.0-alpha2",
"drupal/field_group": "^3.2",
"drupal/file_link": "^2.0.6",
"drupal/facets_form": "1.0.0-alpha2",
"drupal/pathauto": "^1.8",
"drupal/search_api": "^1.21",
"drupal/search_api_autocomplete": "^1.5",
Expand All @@ -43,12 +45,13 @@
"openeuropa/oe_content": "^2.8.0",
"openeuropa/oe_content_extra": "1.x-dev",
"openeuropa/oe_corporate_blocks": "^4.4",
"openeuropa/oe_list_pages": "^0.16",
"openeuropa/oe_media": "^1.14",
"openeuropa/oe_multilingual": "^1.9",
"openeuropa/oe_paragraphs": "^1.13",
"openeuropa/oe_starter_content": "^1.0.0-beta1",
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta5",
"phpspec/prophecy-phpunit": "^1 || ^2",
"phpspec/prophecy-phpunit": "^2",
"symfony/dom-crawler": "^4.4.12"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions modules/oe_whitelabel_list_pages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OpenEuropa Whitelabel list pages

This module is a theming companion module to the [OpenEuropa List Pages](https://github.com/openeuropa/oe_list_pages) component. It provides the logic needed to theme the list pages.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
langcode: en
status: true
dependencies:
config:
- node.type.oe_list_page
module:
- user
id: node.oe_list_page.default
targetEntityType: node
bundle: oe_list_page
mode: default
content:
'extra_field_oe_list_page_filters:node:oe_list_page':
settings: { }
third_party_settings: { }
weight: 2
region: content
'extra_field_oe_list_page_results:node:oe_list_page':
settings: { }
third_party_settings: { }
weight: 1
region: content
'extra_field_oe_list_page_selected_filters:node:oe_list_page':
settings: { }
third_party_settings: { }
weight: 3
region: content
'extra_field_oe_list_page_total_count:node:oe_list_page':
settings: { }
third_party_settings: { }
weight: 0
region: content
hidden:
'extra_field_oe_list_page_pager_info:node:oe_list_page': true
'extra_field_oe_list_page_rss_link:node:oe_list_page': true
langcode: true
links: true
oe_content_content_owner: true
oe_content_legacy_link: true
oe_content_navigation_title: true
oe_content_short_title: true
search_api_excerpt: true
14 changes: 14 additions & 0 deletions modules/oe_whitelabel_list_pages/oe_whitelabel_list_pages.info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: OpenEuropa Whitelabel List Pages
type: module
description: Companion module for the OE List Pages module.
package: OpenEuropa Whitelabel Theme
core_version_requirement: ^9.2

dependencies:
- extra_field:extra_field
- oe_list_pages:oe_list_page_content_type
- oe_list_pages:oe_list_pages

config_devel:
install:
- core.entity_view_display.node.oe_list_page.default
28 changes: 28 additions & 0 deletions modules/oe_whitelabel_list_pages/oe_whitelabel_list_pages.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @file
* OE Whitelabel List Pages module.
*/

declare(strict_types = 1);

use Drupal\Core\Form\FormStateInterface;

/**
* Implements hook_form_FORM_ID_alter() for facets_forms.
*/
function oe_whitelabel_list_pages_form_oe_list_pages_facets_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if (isset($form['actions'])) {
$action_classes = ['mt-4', 'd-grid', 'gap-4', 'd-md-block'];
$form['actions']['#attributes']['class'] = array_unique(array_merge($form['actions']['#attributes']['class'] ?? [], $action_classes));
}
if (isset($form['actions']['submit'])) {
$submit_classes = ['me-md-3', 'btn', 'btn-primary', 'btn-md'];
$form['actions']['submit']['#attributes']['class'] = array_unique(array_merge($form['actions']['submit']['#attributes']['class'] ?? [], $submit_classes));
}
if (isset($form['actions']['reset'])) {
$reset_classes = ['btn', 'btn-light', 'btn-md'];
$form['actions']['reset']['#attributes']['class'] = array_unique(array_merge($form['actions']['reset']['#attributes']['class'] ?? [], $reset_classes));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
langcode: en
status: true
dependencies: { }
id: oe_sc_news_title
name: Title
url_alias: oe_sc_news_title
weight: 0
min_count: 1
show_only_one_result: false
field_identifier: title
facet_source_id: 'list_facet_source:node:oe_sc_news'
widget:
type: oe_list_pages_fulltext
config:
fulltext_all_fields: true
query_operator: or
use_hierarchy: false
keep_hierarchy_parents_active: false
expand_hierarchy: false
enable_parent_when_child_gets_disabled: true
hard_limit: 0
exclude: false
only_visible_when_facet_source_is_visible: false
processor_configs:
active_widget_order:
processor_id: active_widget_order
weights:
sort: 20
settings:
sort: DESC
count_widget_order:
processor_id: count_widget_order
weights:
sort: 30
settings:
sort: DESC
display_value_widget_order:
processor_id: display_value_widget_order
weights:
sort: 40
settings:
sort: ASC
url_processor_handler:
processor_id: url_processor_handler
weights:
pre_query: 50
build: 15
settings: { }
empty_behavior:
behavior: none
show_title: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
langcode: en
status: true
dependencies: { }
id: list_facet_source__node__oe_sc_news
name: 'list_facet_source:node:oe_sc_news'
filter_key: null
url_processor: query_string
breadcrumb: { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
langcode: en
status: true
dependencies:
config:
- search_api.server.oe_whitelabel_list_page_search_server_test
module:
- node
- search_api
id: oe_whitelabel_list_page_index_test
name: oe_whitelabel_list_page_index_test
description: ''
read_only: false
field_settings:
title:
label: Title
datasource_id: 'entity:node'
property_path: title
type: text
dependencies:
module:
- node
datasource_settings:
'entity:node':
bundles:
default: false
selected:
- oe_sc_news
languages:
default: true
selected: { }
processor_settings:
add_url: { }
aggregated_field: { }
entity_type: { }
ignorecase:
weights:
preprocess_index: -20
preprocess_query: -20
all_fields: false
fields:
- title
language_with_fallback: { }
rendered_item: { }
tracker_settings:
default:
indexing_order: fifo
options:
cron_limit: 50
index_directly: true
track_changes_in_references: true
server: oe_whitelabel_list_page_search_server_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
langcode: en
status: true
dependencies:
module:
- search_api_db
id: oe_whitelabel_list_page_search_server_test
name: oe_whitelabel_list_page_search_server_test
description: ''
backend: search_api_db
backend_config:
database: 'default:default'
min_chars: 1
matching: words
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: OpenEuropa Whitelabel List Pages Test
type: module
description: The test module for OE Whitelabel List Pages. Provides EventSubscriber, facets, index and content ready.
package: OpenEuropa Whitelabel Theme
core_version_requirement: ^9.2
dependencies:
- oe_whitelabel_list_pages
- oe_whitelabel_starter_news
- search_api:search_api_db

config_devel:
install:
- facets.facet.oe_sc_news_title
- facets.facet_source.list_facet_source__node__oe_sc_news
- search_api.index.oe_whitelabel_list_page_index_test
- search_api.server.oe_whitelabel_list_page_search_server_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

/**
* @file
* The OpenEuropa Whitelabel List Pages install file.
*/

declare(strict_types = 1);

/**
* Implements hook_install().
*/
function oe_whitelabel_list_pages_test_install($is_syncing) {
// Clear the facets source cached definitions so the new ones can be found.
\Drupal::service('plugin.manager.facets.facet_source')->clearCachedDefinitions();
}
Loading

0 comments on commit 18a4933

Please sign in to comment.