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'); $raw = @file_get_contents('addon/vs01/config.json');
if ($raw !== false) { if ($raw === false) return;
$cfg = json_decode($raw, true); $cfg = json_decode($raw, true);
if (json_last_error() === JSON_ERROR_NONE && isset($cfg['associations'][$slug])) { if (json_last_error() !== JSON_ERROR_NONE) return;
if (!isset($cfg['associations'][$slug])) return;
// Read core channel PDL. theme_include() checks theme overrides first,
// 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( $b['layout'] = str_replace(
'[region=right_aside]', '[region=right_aside]',
'[region=right_aside]' . " '[region=right_aside]' . "\n" . '[widget=civicnav][/widget]',
" . '[widget=civicnav][/widget]', $layout
$b['layout'] ?? ''
); );
}
}
}
return; return;
} }