Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4040 Map Enterprise Attributes during Trellis Events import #4053

Open
wants to merge 48 commits into
base: issue/4039-add-enterprise-attributes-to-events
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5098edd
Close #4039 Add Enterprise Attributes to az_events
trackleft Feb 7, 2025
2d0c14e
Update weights and event form display for az_seo
trackleft Feb 7, 2025
7ab4b6e
Update core.entity_form_display.node.az_event.default.yml
trackleft Feb 7, 2025
6c36f10
Close #4039 tag imported events with enterprise attributes.
trackleft Feb 8, 2025
eba5d0c
Update names
trackleft Feb 8, 2025
62e3785
Update names
trackleft Feb 8, 2025
af9f8b4
Remove migration updates
trackleft Feb 10, 2025
88e407a
Merge branch 'issue/4039-add-enterprise-attributes-to-events' of gith…
trackleft Feb 10, 2025
c26753c
Update weights and dependencies.
trackleft Feb 10, 2025
ddf1913
Update weights and dependencies.
trackleft Feb 10, 2025
0c6c5a3
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 10, 2025
96bdf20
Update weights
trackleft Feb 10, 2025
3a5c879
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 10, 2025
d39aa69
slight adjustments
trackleft Feb 10, 2025
5787502
Re-export config for az_enterprise_attributes_import migration.
trackleft Feb 10, 2025
c129f7f
rename plugin
trackleft Feb 10, 2025
6e2192e
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 12, 2025
594ff3f
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 12, 2025
c97fde7
Update modules/custom/az_event/config/install/core.entity_form_displa…
trackleft Feb 12, 2025
b83e45e
Update modules/custom/az_seo/config/quickstart/core.entity_form_displ…
trackleft Feb 12, 2025
b0bb0cf
Update modules/custom/az_event/config/install/core.entity_form_displa…
trackleft Feb 12, 2025
41abde9
Integrate suggestions.
trackleft Feb 12, 2025
9d07cbb
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 12, 2025
dc4eb67
Update to include format
trackleft Feb 12, 2025
7e22136
Get format too
trackleft Feb 12, 2025
2a334eb
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 12, 2025
0399bc0
Merge branch 'main' into issue/4039-add-enterprise-attributes-to-events
trackleft Feb 14, 2025
b4fe55f
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 14, 2025
72471d5
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 19, 2025
274619b
Simplify migration since we don't need labels/parents
trackleft Feb 19, 2025
90c3d5c
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 19, 2025
9802ef7
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 19, 2025
fb1b83c
spacing
trackleft Feb 19, 2025
6580e99
Allow 'Lectures, Workshops & Panels'
trackleft Feb 19, 2025
2eeb7ba
PHPCS and update to add exceptions list
trackleft Feb 19, 2025
aed3215
Fix massage values method.
trackleft Feb 19, 2025
bd7cddd
Merge branch 'issue/4039-add-enterprise-attributes-to-events' into is…
trackleft Feb 19, 2025
e7b7556
Provide mechanism for allowing commas in the name of the term
trackleft Feb 19, 2025
87bc971
Merge branch 'issue/4040-map-enterprise-attributes-during-trellis-eve…
trackleft Feb 19, 2025
247363c
Coding standards
trackleft Feb 19, 2025
2740d7e
PHPCS
trackleft Feb 19, 2025
d58c0d7
Remove need for process plugin.
trackleft Feb 20, 2025
22f0848
Delete process plugin
trackleft Feb 20, 2025
e2b050f
remove skip on empty
trackleft Feb 20, 2025
5fb301c
Update modules/custom/az_event/az_event_trellis/config/install/migrat…
trackleft Feb 20, 2025
0d237c8
Refactor migration
trackleft Feb 20, 2025
c1df405
remove an explode
trackleft Feb 20, 2025
e31075c
Refactor more
trackleft Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
langcode: en
status: true
dependencies:
enforced:
module:
- az_core
id: az_enterprise_attributes_import
label: Enterprise Attributes
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
- Enterprise Attributes
- 'Enterprise Attributes'
- Taxonomy
migration_group: null
label: 'Enterprise Attributes'
source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: az_enterprise_attributes_import_json
urls: []
urls: { }
item_selector: attributes
ids:
key:
type: string

fields:
-
name: value
Expand All @@ -26,7 +35,6 @@ source:
-
name: parent
selector: parent

process:
name:
- plugin: skip_on_value
Expand All @@ -49,12 +57,7 @@ process:
-
plugin: default_value
default_value: 0

destination:
plugin: entity:taxonomy_term
plugin: 'entity:taxonomy_term'
default_bundle: az_enterprise_attributes

dependencies:
enforced:
module:
- az_core
migration_dependencies: null
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
langcode: en
status: true
dependencies: { }
dependencies:
module:
- az_enterprise_attributes_import
id: az_enterprise_attributes_import
label: 'AZ Enterprise Attributes'
description: 'Import Enterprise Attributes'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

namespace Drupal\az_enterprise_attributes_import\Plugin\migrate\process;

use Drupal\migrate\Attribute\MigrateProcess;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;

/**
* Flattens a multi-dimensional array.
*
* @code
* process:
* field_of_array_values:
* - plugin: az_enterprise_attributes_flatten
* source: enterprise_attributes_array
* - plugin: flatten
* @endcode
*/
#[MigrateProcess('az_enterprise_attributes_flatten')]
class AZEnterpriseAttributesArrayFlatten extends ProcessPluginBase {

/**
* {@inheritdoc}
*/
public function transform($input, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!is_array($input)) {
return $input;
}

$result = [];

foreach ($input as $value) {
if (is_array($value) && isset($value[0]) && is_string($value[0])) {
$result = array_merge($result, array_map('trim', explode(',', $value[0])));
}
}

return array_values(array_unique($result));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,49 @@ source:
name: publish
label: Publish
selector: Publish_Formula
-
name: az_enterprise_attributes
label: 'Enterprise Attributes'
selector: Attributes
-
name: format
label: 'Format'
selector: Format
ids:
id:
type: string
process:
pseudo_az_enterprise_attributes_format:
-
plugin: default_value
default_value: ['Event Format']
pseudo_az_enterprise_attributes_format_value:
-
plugin: explode
delimiter: ','
source: format
pseudo_az_enterprise_attributes:
-
plugin: az_enterprise_attributes_flatten
source: az_enterprise_attributes
-
plugin: flatten
-
plugin: default_value
default_value: []

field_az_enterprise_attributes:
- plugin: merge
source:
- '@pseudo_az_enterprise_attributes_format_value'
- '@pseudo_az_enterprise_attributes'
-
plugin: entity_lookup
entity_type: taxonomy_term
bundle_key: vid
bundle: az_enterprise_attributes
value_key: name
ignore_case: true
title: name
field_az_trellis_id: id
field_az_link/uri: url
Expand Down
Loading