Link to LGA pages from pledge page.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class SPLPageRenderer {
|
class SPLPageRenderer {
|
||||||
public function renderPledgePage($councils, $candidates) {
|
public function renderPledgePage($councils, $lga_pages, $candidates) {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$didError = false;
|
$didError = false;
|
||||||
|
|||||||
@@ -39,15 +39,22 @@ $renderer = new SPLPageRenderer();
|
|||||||
//print_r($pledgeCandidates);
|
//print_r($pledgeCandidates);
|
||||||
|
|
||||||
$councils = [];
|
$councils = [];
|
||||||
|
$lga_pages_unsort = [];
|
||||||
foreach ($pledgeCandidates as $key => $candidate) {
|
foreach ($pledgeCandidates as $key => $candidate) {
|
||||||
$councils[] = $candidate['Council'];
|
$councils[] = $candidate['Council'];
|
||||||
|
$lga_pages_unsort[] = basename($candidate['Path']);
|
||||||
}
|
}
|
||||||
$councils = array_unique($councils);
|
$councils = array_unique($councils);
|
||||||
asort($councils);
|
asort($councils);
|
||||||
|
|
||||||
|
$lga_pages = [];
|
||||||
|
foreach ($councils as $key => $council) {
|
||||||
|
$lga_pages[$key] = $lga_pages_unsort[$key];
|
||||||
|
}
|
||||||
|
|
||||||
//print_r($councils);
|
//print_r($councils);
|
||||||
|
|
||||||
$pageContent = $renderer->renderPledgePage($councils, $pledgeCandidates);
|
$pageContent = $renderer->renderPledgePage($councils, $lga_pages, $pledgeCandidates);
|
||||||
|
|
||||||
if ($pageContent === null) {
|
if ($pageContent === null) {
|
||||||
exit(2);
|
exit(2);
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ $councilCount = count($councils);
|
|||||||
|
|
||||||
<?php foreach ($councils as $key => $council): ?>
|
<?php foreach ($councils as $key => $council): ?>
|
||||||
<!-- wp:heading {"level":3,"className":"is-style-default"} -->
|
<!-- wp:heading {"level":3,"className":"is-style-default"} -->
|
||||||
<?php $groupSlug = sluggify($council); ?>
|
<?php $lga_page = $lga_pages[$key]; ?>
|
||||||
<h3 class="wp-block-heading is-style-default" id="<?php echo $groupSlug; ?>"><a style="text-decoration: none;" href="#<?php echo $groupSlug; ?>"><?php echo htmlspecialchars($council); ?></a></h3>
|
<h3 class="wp-block-heading is-style-default" id="<?php echo $lga_page; ?>"><a style="text-decoration: none;" href="/<?php echo $lga_page; ?>"><?php echo htmlspecialchars($council); ?></a></h3>
|
||||||
<!-- /wp:heading -->
|
<!-- /wp:heading -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user