Add legacy caption/title compatibility styling for configurable pane

This commit is contained in:
2026-03-04 15:39:18 +11:00
parent f4e6824181
commit 1f7de53785
4 changed files with 62 additions and 10 deletions

View File

@@ -9,12 +9,28 @@ It lets editors set view target and contextual arguments per block instance, sim
## Install
1. Place this module at:
`web/modules/custom/configurable_views_pane`
2. Enable module:
`drush en configurable_views_pane -y`
3. Rebuild cache:
`drush cr`
Clone into Drupal custom modules and enable:
```bash
cd /path/to/drupal-root/web/modules/custom
git clone https://git.coadcorp.com/drupal/configurable_views_pane.git configurable_views_pane
cd /path/to/drupal-root
drush en configurable_views_pane -y
drush cr
```
For `studyweek11` Docker stack:
```bash
mkdir -p drupal/web/modules/custom
if [ -d drupal/web/modules/custom/configurable_views_pane/.git ]; then
git -C drupal/web/modules/custom/configurable_views_pane pull --ff-only
else
rm -rf drupal/web/modules/custom/configurable_views_pane
git clone https://git.coadcorp.com/drupal/configurable_views_pane.git drupal/web/modules/custom/configurable_views_pane
fi
docker compose -f docker-compose.yml exec -T php sh -lc 'cd /var/www/html && vendor/bin/drush en configurable_views_pane -y && vendor/bin/drush cr'
```
## Use in Page Manager
@@ -27,3 +43,6 @@ Add block **Configurable Views Pane** and set:
## Notes
- This module intentionally keeps plugin id `booking_configurable_views_pane` for compatibility with any existing block config already using that id.
- Includes a small compatibility stylesheet for legacy D7-like output:
- hides `caption > h2.left` headings (for example large `General` captions),
- promotes `.block__title` size for blocks that render this pane.

View File

@@ -0,0 +1,6 @@
block:
version: 1.x
css:
theme:
css/configurable_views_pane.block.css: {}

View File

@@ -0,0 +1,19 @@
/*
* Legacy D7 view output compatibility tweaks for configurable views pane blocks.
*/
/* Hide oversized legacy pretty-table caption headings such as "General". */
.configurable-views-pane-block caption > h2.left {
display: none !important;
}
/* Match Page Manager block titles to legacy large left-aligned heading style. */
.block:has(.configurable-views-pane-block) > h2.block__title {
font-size: var(--cvp-legacy-title-size, 2rem) !important;
font-weight: var(--cvp-legacy-title-weight, 700) !important;
line-height: var(--cvp-legacy-title-line-height, 1.2) !important;
text-align: left;
margin: 0 0 0.5rem;
letter-spacing: normal;
text-transform: none;
}

View File

@@ -68,13 +68,21 @@ final class ConfigurableViewsPaneBlock extends BlockBase {
}
$args = $this->parseArguments((string) ($this->configuration['arguments'] ?? ''));
$build = $view->buildRenderable($display_id, $args, FALSE);
if (!is_array($build)) {
$view_build = $view->buildRenderable($display_id, $args, FALSE);
if (!is_array($view_build)) {
return [];
}
$build['#attributes']['class'][] = 'configurable-views-pane-block';
return $build;
return [
'#type' => 'container',
'#attributes' => [
'class' => ['configurable-views-pane-block'],
],
'content' => $view_build,
'#attached' => [
'library' => ['configurable_views_pane/block'],
],
];
}
/**