Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
updated hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio committed Aug 30, 2024
1 parent a885ab9 commit 83e35b8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 24 deletions.
56 changes: 54 additions & 2 deletions modules/tide_site_theming/src/TideSiteThemingOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,38 @@ public function requiredChangesForTheming() {
];
$entity_form_display->setThirdPartySetting('field_group', 'group_site_favicon_value', $field_group['group_site_favicon_value']);

// Adds app icon.
$entity_form_display->setComponent('field_site_app_icon', [
'type' => 'image_image',
'weight' => 20,
'region' => 'content',
'settings' => [
'progress_indicator' => 'throbber',
'preview_image_style' => 'thumbnail',
],
'third_party_settings' => [],
]);
$field_group = $entity_form_display->getThirdPartySettings('field_group');
$field_group['group_site_app_icon'] = [
'children' => [
'field_site_app_icon',
],
'parent_name' => '',
'label' => 'Site app icon',
'weight' => 19,
'format_type' => 'details',
'region' => 'content',
'format_settings' => [
'classes' => '',
'show_empty_fields' => FALSE,
'id' => 'tide-site-app-icon',
'open' => FALSE,
'required_fields' => TRUE,
'effect' => 'none',
],
];
$entity_form_display->setThirdPartySetting('field_group', 'group_site_app_icon', $field_group['group_site_app_icon']);

// Adds header corner graphics.
$entity_form_display->setComponent('field_top_corner_graphic', [
'type' => 'image_image',
Expand Down Expand Up @@ -219,7 +251,7 @@ public function requiredChangesForTheming() {
],
'third_party_settings' => [],
])->save();
$entity_view_display->setComponent('field_top_corner_graphic', [
$entity_view_display->setComponent('field_site_app_icon', [
'type' => 'image',
'weight' => 19,
'label' => 'above',
Expand All @@ -238,7 +270,7 @@ public function requiredChangesForTheming() {
],
'third_party_settings' => [],
])->save();
$entity_view_display->setComponent('field_bottom_corner_graphic', [
$entity_view_display->setComponent('field_top_corner_graphic', [
'type' => 'image',
'weight' => 20,
'label' => 'above',
Expand All @@ -257,6 +289,25 @@ public function requiredChangesForTheming() {
],
'third_party_settings' => [],
])->save();
$entity_view_display->setComponent('field_bottom_corner_graphic', [
'type' => 'image',
'weight' => 21,
'label' => 'above',
'region' => 'content',
'settings' => [
'image_link' => '',
'image_style' => '',
'svg_attributes' => [
'width' => NULL,
'height' => NULL,
],
'svg_render_as_image' => TRUE,
'image_loading' => [
'attribute' => 'lazy',
],
],
'third_party_settings' => [],
])->save();
}

// Grant view preview links block to default roles from tide_core.
Expand All @@ -272,6 +323,7 @@ public function requiredChangesForTheming() {
'field_site_theme_values',
'field_site_feature_flags',
'field_site_favicon',
'field_site_app_icon',
'field_top_corner_graphic',
'field_bottom_corner_graphic',
];
Expand Down
22 changes: 0 additions & 22 deletions modules/tide_site_theming/tide_site_theming.install
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,4 @@ function tide_site_theming_update_10001() {
}
}

// Add to JSON.
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('jsonapi_extras.jsonapi_resource_config.taxonomy_term--sites');
$resourcefields_fields = [
'field_site_app_icon',
'field_short_name',
];
$content = $config->get('resourceFields');
foreach ($resourcefields_fields as $field) {
if (!isset($content[$field])) {
$content[$field] = [
'fieldName' => $field,
'publicName' => $field,
'enhancer' => [
'id' => '',
],
'disabled' => FALSE,
];
$config->set('resourceFields', $content);
}
}
$config->save();
}

0 comments on commit 83e35b8

Please sign in to comment.