Skip to content

Commit

Permalink
chore(SLB-512): merging feat/SLB-512--taxonomy-filters-content-hub - dev
Browse files Browse the repository at this point in the history
  • Loading branch information
elistone committed Jan 20, 2025
2 parents d7036ea + 5fbe3cb commit b7eb42e
Show file tree
Hide file tree
Showing 71 changed files with 1,218 additions and 101 deletions.
7 changes: 7 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions apps/cms/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
},
"drupal/coffee": {
"On the fly ajax search POC": "./patches/contrib/coffee/on_the_fly_ajax_search_poc.patch"
},
"amazeelabs/graphql_directives": {
"Fixing issue with extracting term label": "./patches/contrib/graphql_directives/extract_term_label.patch"
}
},
"patchLevel": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ status: true
dependencies:
config:
- field.field.node.page.body
- field.field.node.page.field_content_hub_terms
- field.field.node.page.field_metatags
- field.field.node.page.field_seo_description
- field.field.node.page.field_seo_image
Expand All @@ -14,6 +15,7 @@ dependencies:
- content_moderation
- field_group
- media_library
- field_group
- metatag
- path
- text
Expand All @@ -37,6 +39,23 @@ third_party_settings:
open: false
description: ''
required_fields: true
group_taxonomy:
children:
- field_content_hub_terms
label: Taxonomy
region: content
parent_name: ''
weight: 14
format_type: details_sidebar
format_settings:
classes: ''
show_empty_fields: false
id: ''
label_as_html: false
open: false
description: ''
required_fields: true
weight: 0
id: node.page.default
targetEntityType: node
bundle: page
Expand All @@ -58,6 +77,12 @@ content:
region: content
settings: { }
third_party_settings: { }
field_content_hub_terms:
type: options_buttons
weight: 13
region: content
settings: { }
third_party_settings: { }
field_metatags:
type: metatag_firehose
weight: 12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- core.entity_form_mode.node.split
- field.field.node.page.body
- field.field.node.page.field_content_hub_terms
- field.field.node.page.field_metatags
- field.field.node.page.field_seo_description
- field.field.node.page.field_seo_image
Expand Down Expand Up @@ -107,3 +108,4 @@ hidden:
field_seo_description: true
field_seo_image: true
field_seo_title: true
field_content_hub_terms: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ status: true
dependencies:
config:
- field.field.node.page.body
- field.field.node.page.field_content_hub_terms
- field.field.node.page.field_metatags
- field.field.node.page.field_seo_description
- field.field.node.page.field_seo_image
Expand Down Expand Up @@ -33,12 +34,20 @@ content:
third_party_settings: { }
weight: 1
region: content
field_content_hub_terms:
type: entity_reference_label
label: above
settings:
link: false
third_party_settings: { }
weight: 2
region: content
field_metatags:
type: metatag_empty_formatter
label: above
settings: { }
third_party_settings: { }
weight: 2
weight: 3
region: content
field_seo_title:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- core.entity_view_mode.node.global_search
- field.field.node.page.body
- field.field.node.page.field_content_hub_terms
- field.field.node.page.field_metatags
- field.field.node.page.field_seo_description
- field.field.node.page.field_seo_image
Expand Down Expand Up @@ -54,6 +55,7 @@ hidden:
content_moderation_control: true
external_preview_link: true
field_seo_image: true
field_content_hub_terms: true
langcode: true
links: true
search_api_excerpt: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.page.body
- field.field.node.page.field_content_hub_terms
- field.field.node.page.field_metatags
- field.field.node.page.field_seo_description
- field.field.node.page.field_seo_image
Expand Down Expand Up @@ -48,6 +49,7 @@ content:
weight: 100
region: content
hidden:
field_content_hub_terms: true
field_metatags: true
field_seo_description: true
field_seo_image: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
uuid: 7d302dca-53f0-4144-89a6-fc5d6aa7b212
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_content_hub_terms
- node.type.page
- taxonomy.vocabulary.content_hub
id: node.page.field_content_hub_terms
field_name: field_content_hub_terms
entity_type: node
bundle: page
label: 'Content Hub Terms'
description: 'Tag the content to help with filtering on the content hub page.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
content_hub: content_hub
sort:
field: name
direction: asc
auto_create: false
auto_create_bundle: ''
field_type: entity_reference
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
uuid: 56980077-3ced-49ce-9c99-7665e3d42507
langcode: en
status: true
dependencies:
module:
- node
- taxonomy
id: node.field_content_hub_terms
field_name: field_content_hub_terms
entity_type: node
type: entity_reference
settings:
target_type: taxonomy_term
module: core
locked: false
cardinality: -1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
uuid: 61d33149-ccaf-400e-ab9e-1dc850353772
langcode: en
status: true
dependencies:
config:
- taxonomy.vocabulary.content_hub
module:
- content_translation
third_party_settings:
content_translation:
enabled: true
id: taxonomy_term.content_hub
target_entity_type_id: taxonomy_term
target_bundle: content_hub
default_langcode: site_default
language_alterable: true
9 changes: 9 additions & 0 deletions apps/cms/config/sync/taxonomy.vocabulary.content_hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
uuid: c2b84fb1-39ac-4c9a-81a9-88f5973790aa
langcode: en
status: true
dependencies: { }
name: 'Content Hub'
vid: content_hub
description: 'Tag content for filtering on the content hub.'
weight: 0
new_revision: false
52 changes: 52 additions & 0 deletions apps/cms/config/sync/views.view.content_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ status: true
dependencies:
config:
- node.type.page
- taxonomy.vocabulary.content_hub
module:
- node
- taxonomy
- user
id: content_hub
label: 'Content hub'
Expand Down Expand Up @@ -282,6 +284,56 @@ display:
1: { }
2: { }
3: { }
field_content_hub_terms_target_id:
id: field_content_hub_terms_target_id
table: node__field_content_hub_terms
field: field_content_hub_terms_target_id
relationship: none
group_type: group
admin_label: ''
plugin_id: taxonomy_index_tid
operator: or
value: { }
group: 1
exposed: true
expose:
operator_id: field_content_hub_terms_target_id_op
label: 'Content Hub Terms'
description: ''
use_operator: false
operator: field_content_hub_terms_target_id_op
operator_limit_selection: false
operator_list: { }
identifier: terms
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
anonymous: '0'
super_admin: '0'
administrator: '0'
gatsby_build: '0'
editor: '0'
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: true
vid: content_hub
type: select
hierarchy: true
limit: true
error_message: true
filter_groups:
operator: AND
groups:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/Plugin/GraphQL/DataProducer/DrupalView.php b/src/Plugin/GraphQL/DataProducer/DrupalView.php
index 43ca191ec..5554e126d 100644
--- a/src/Plugin/GraphQL/DataProducer/DrupalView.php
+++ b/src/Plugin/GraphQL/DataProducer/DrupalView.php
@@ -99,6 +99,9 @@ public function resolve(string $id, ?string $args, FieldContext $context): array
foreach (Element::children($form) as $key) {
if (isset($form[$key]['#options'])) {
foreach ($form[$key]['#options'] as $value => $label) {
+ if (is_object($label) && isset($label->option)) {
+ $label = $label->option;
+ }
$filters[$key][] = [
'value' => (string)$value,
'label' => (string)$label,
2 changes: 2 additions & 0 deletions apps/decap/data/translatables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ de:
fe0rMF: Suchbegriff
jHJmjf: Keine Ergebnisse
xmcVZ0: Suchen
EqfeAF: Filtern nach Begriffen
wREPik: Etwas ist schiefgelaufen
en:
FPGwAt: Random Company
15 changes: 15 additions & 0 deletions apps/decap/src/collections/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export const PageCollection: CmsCollection = {
required: true,
i18n: true,
},
{
label: 'Terms',
name: 'terms',
widget: 'string',
required: false,
i18n: false,
},
{
label: 'Teaser image',
name: 'teaserImage',
Expand Down Expand Up @@ -228,6 +235,14 @@ export const getPages: SilverbackSource<DecapPageSource> = () => {
url: editUrl,
type: 'decap',
},
terms: [
{
__typename: 'TermContentHub',
label: 'Test',
termId: '1',
depth: 0,
},
],
},
]);
} else {
Expand Down
23 changes: 23 additions & 0 deletions packages/drupal/custom/custom.module
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,29 @@ function custom_form_alter(&$form, FormStateInterface $form_state, $form_id) {
}
}

// Check if something has been moved to `details_sidebar`
$groups = $form['#fieldgroups'] ?? [];
foreach ($groups as $group) {
if ($group->format_type === 'details_sidebar') {
$updated = FALSE;
$group_name = $group->group_name ?? 'unknown_group';
$children = $group->children ?? [];

foreach ($children as $child) {
if (isset($form[$child])) {
if($form[$child]['#group'] === "metabox_fields") {
$form[$child]['#group'] = $group_name;
$updated = TRUE;
}
}
}

if ($updated && $group->parent_name === 'metabox_fields') {
$group->parent_name = $group_name;
}
}
}

// If the "More settings" fieldset is empty, remove it completely.
$metaboxHasFields = FALSE;
foreach (Element::children($form) as $key) {
Expand Down
Loading

0 comments on commit b7eb42e

Please sign in to comment.