8000 1.8.6 Release by finnlewis · Pull Request #717 · localgovdrupal/localgov_base · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

1.8.6 Release #717

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

Merged
merged 1 commit into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions config/install/localgov_base.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ localgov_base_remove_js: FALSE
localgov_base_add_unpublished_background_colour: TRUE
localgov_base_add_draft_note_to_unpublished_content: FALSE
localgov_base_header_behaviour: 'default'
localgov_base_localgov_guides_stacked_heading: FALSE
localgov_base_localgov_guides_vertical_navigation: TRUE
8 changes: 8 additions & 0 deletions config/schema/localgov_base.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ localgov_base.settings:
description: 'Choose whether the header should be sticky or not.'
constraints:
Regex: '^(default|sticky|appears_on_scroll)$'
localgov_base_localgov_guides_stacked_heading:
type: boolean
label: 'Stacked heading'
description: 'Choose whether the heading should be stacked or not.'
localgov_base_localgov_guides_vertical_navigation:
type: boolean
label: 'Vertical navigation'
description: 'Choose whether the navigation should be vertical or not.'
1 change: 1 addition & 0 deletions css/base/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ body {
/* Page Title */
--page-title-border: var(--border);
--page-title-width: var(--width-medium);
--page-title-subtitle-font-size: var(--font-size-h2);
--page-title-lede-font-size: var(--font-size-h3);

/* Form Item Description Items */
Expand Down
4 changes: 2 additions & 2 deletions css/components/guide-nav.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
}

@media screen and (min-width: 48rem) {
.block-localgov-guides-contents--vertical .lgd-guide-nav__list {
.block-localgov-guides-contents--navigation-vertical .lgd-guide-nav__list {
column-count: 1;
}

.block-localgov-guides-contents--horizontal .lgd-guide-nav__list,
.block-localgov-guides-contents--navigation-horizontal .lgd-guide-nav__list,
.lgd-guide-nav__list {
column-count: var(--guide-nav-column-count);
}
Expand Down
5 changes: 5 additions & 0 deletions css/components/page-title-block.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
max-width: var(--page-title-width);
}

.lgd-page-title-block__subtitle {
font-size: var(--page-title-subtitle-font-size);
}

.lgd-page-title-block__subtitle,
.lgd-page-title-block__subheader {
font-size: var(--page-title-lede-font-size);
}
42 changes: 40 additions & 2 deletions localgov_base.theme
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ function localgov_base_form_system_theme_settings_alter(&$form, FormStateInterfa
'#default_value' => theme_get_setting('localgov_base_add_draft_note_to_unpublished_content'),
'#description' => t('This adds the word "Draft" to the title of any unpublished content. This is useful if you have removed the pink background from unpublished content.'),
];

$form['localgov_base_show_back_to_top_link'] = [
'#type' => 'checkbox',
'#title' => t('Display a "Back to Top" link on long pages.'),
'#default_value' => theme_get_setting('localgov_base_show_back_to_top_link'),
'#description' => t('This adds a link to the beginning of the page content (<code>#main-content</code>).'),
];

$form['localgov_base_header_behaviour'] = [
'#type' => 'radios',
'#title' => t('Header behaviour'),
Expand All @@ -65,6 +67,19 @@ function localgov_base_form_system_theme_settings_alter(&$form, FormStateInterfa
'#description' => t('Select how you want the header to behave. This setting only apply to anonymous users.'),
];

$form['localgov_base_localgov_guides_stacked_heading'] = [
'#type' => 'checkbox',
'#title' => t('Use stacked heading pattern for guides.'),
'#default_value' => theme_get_setting('localgov_base_localgov_guides_stacked_heading'),
'#description' => t('This will stack the Guide title and page heading on top of each other.'),
];

$form['localgov_base_localgov_guides_vertical_navigation'] = [
'#type' => 'checkbox',
'#title' => t('Use vertical navigation for guides.'),
'#default_value' => theme_get_setting('localgov_base_localgov_guides_vertical_navigation'),
'#description' => t('This will display the guide navigation vertically above the guide.'),
];
}

/**
Expand Down Expand Up @@ -197,21 +212,44 @@ function localgov_base_preprocess_node(&$variables): void {
* Implements hook_preprocess_HOOK().
*/
function localgov_base_preprocess_block(&$variables): void {
$route_match = Drupal::routeMatch();
$route = $route_match->getRouteName();
if ($variables['plugin_id'] === 'localgov_page_header_block') {
$route_match = Drupal::routeMatch();

// Check if we are on a node page, latest version or a preview link.
$route = $route_match->getRouteName();
if ($route === 'entity.node.canonical' || $route === 'entity.node.latest_version' || $route === 'entity.node.preview_link') {
$node = $route_match->getParameter('node');
$node_status = $node->isPublished();
$node_type = $node->getType();
if ($node_status === FALSE) {
if (theme_get_setting('localgov_base_add_draft_note_to_unpublished_content') === TRUE) {
$current_title = $variables['content'][0]['#title'];
$variables['content'][0]['#title'] = t('[Draft]') . " " . $current_title;
}
}

// Check if we should use the stacked heading pattern for guides.
// This places the guide title on top of the node title, all within the
// same h1 element, like the NHS design system.
if ($node_type === 'localgov_guides_page' && theme_get_setting('localgov_base_localgov_guides_stacked_heading') === TRUE) {
$node_title = $node->getTitle();
$variables['content'][0]['#subtitle'] = $node_title;
}
}
}

// Add vertical or horizontal class to the guides navigation block.
// In config, this will default to vertical for new installations, but remain
// horizontal for existing installations.
if ($variables['plugin_id'] === 'localgov_guides_contents') {
if (theme_get_setting('localgov_base_localgov_guides_vertical_navigation') === TRUE) {
$variables['attributes']['class'][] = 'block-localgov-guides-contents--navigation-vertical';
}
else {
$variables['attributes']['class'][] = 'block-localgov-guides-contents--navigation-horizontal';
}
}

}

/**
Expand Down
0