Skip to content
Snippets Groups Projects

Issue #3352329: [DS-502][Branch CT] Indicate that Header, Content, and Bottom Area are deprecated

Merged Max requested to merge issue/y_branch-3352329:3352329-ds-502branch-ct-indicate into 1.0.x
2 files
+ 70
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 69
0
@@ -21,6 +21,7 @@ function y_branch_install() {
_y_branch_update_displays_on_install();
// Create and modify Branch content type field groups on the form.
_y_branch_create_field_groups();
_y_branch_update_field_groups_on_install();
}
/**
@@ -33,6 +34,7 @@ function y_branch_uninstall() {
_y_branch_update_displays_on_unistall();
// Update and remove Branch content type field groups on the form.
_y_branch_remove_field_groups();
_y_branch_update_field_groups_on_uninstall();
}
/**
@@ -134,6 +136,66 @@ function _y_branch_create_field_groups() {
field_group_group_save($group_branch_hours);
}
/**
* Update required field groups on install.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
function _y_branch_update_field_groups_on_install() {
// Deprecate existing groups.
$deprecated_groups = [
30 => 'group_header_area',
31 => 'group_content_area',
32 => 'group_bottom_area',
];
foreach ($deprecated_groups as $weight => $deprecated_group) {
$group = field_group_load_field_group($deprecated_group, 'node', 'branch', 'form', 'default');
if ($group) {
$group->weight = $weight;
$group->label = $group->label . ' (deprecated, not displayed in Layout Builder)';
}
field_group_group_save($group);
}
// Move to the top new groups.
$move_above_groups = [
16 => 'group_branch_menu',
17 => 'group_branch_amenities',
];
foreach ($move_above_groups as $weight => $above_group) {
$group = field_group_load_field_group($above_group, 'node', 'branch', 'form', 'default');
if ($group) {
$group->weight = $weight;
}
field_group_group_save($group);
}
}
/**
* Update required field groups on uninstall.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
function _y_branch_update_field_groups_on_uninstall() {
// Deprecate existing groups.
$deprecated_groups = [
18 => 'group_header_area',
19 => 'group_content_area',
20 => 'group_bottom_area',
];
foreach ($deprecated_groups as $weight => $deprecated_group) {
$group = field_group_load_field_group($deprecated_group, 'node', 'branch', 'form', 'default');
if ($group) {
$group->weight = $weight;
$group->label = str_replace(' (deprecated, not displayed in Layout Builder)', '', $group->label);
}
field_group_group_save($group);
}
}
/**
* Update Branch content type display modes on enabling the module.
*
@@ -402,3 +464,10 @@ function y_branch_update_9002(&$sandbox = NULL) {
}
}
}
/**
* Update field groups.
*/
function y_branch_update_9003(&$sandbox = NULL) {
_y_branch_update_field_groups_on_install();
}
Loading