This commit is contained in:
2026-06-07 08:26:34 -04:00
parent 5e97133c7c
commit 7fdd9bc5b2

View File

@@ -32,24 +32,34 @@ function vs01_load_pdl(&$b) {
return; return;
} }
// On association channel pages: inject civicnav into right_aside. // On association channel pages: read core mod_channel.pdl and inject
// civicnav widget as first widget in right_aside.
if ($b['module'] === 'channel') { if ($b['module'] === 'channel') {
$addr = App::$profile['channel_address'] ?? ''; $addr = App::$profile['channel_address'] ?? '';
$slug = $addr ? explode('@', $addr)[0] : ''; $slug = $addr ? explode('@', $addr)[0] : '';
if ($slug) { if (!$slug) return;
$raw = @file_get_contents('addon/vs01/config.json');
if ($raw !== false) { $raw = @file_get_contents('addon/vs01/config.json');
$cfg = json_decode($raw, true); if ($raw === false) return;
if (json_last_error() === JSON_ERROR_NONE && isset($cfg['associations'][$slug])) { $cfg = json_decode($raw, true);
$b['layout'] = str_replace( if (json_last_error() !== JSON_ERROR_NONE) return;
'[region=right_aside]', if (!isset($cfg['associations'][$slug])) return;
'[region=right_aside]' . "
" . '[widget=civicnav][/widget]', // Read core channel PDL. theme_include() checks theme overrides first,
$b['layout'] ?? '' // then falls back to view/pdl/. We mirror that lookup here.
); $p = theme_include('mod_channel.pdl');
} $layout = $p ? @file_get_contents($p) : '';
} if (!$layout) {
$layout = @file_get_contents('view/pdl/mod_channel.pdl');
} }
if (!$layout) return;
// Inject civicnav as first widget in right_aside.
$b['layout'] = str_replace(
'[region=right_aside]',
'[region=right_aside]' . "\n" . '[widget=civicnav][/widget]',
$layout
);
return; return;
} }