Skip to content

Commit

Permalink
Ensure links from T&C index to Mostly Static Pages also include the b…
Browse files Browse the repository at this point in the history
…ase URL (CFM-501)
  • Loading branch information
arlen committed Feb 13, 2026
1 parent 4353aed commit 6da4bce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions app/src/Controller/TermsAndConditionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ class TermsAndConditionsController extends StandardController {
]
];

/**
* Callback run prior to the request render.
*
* @since COmanage Registry v5.1.0
* @param EventInterface $event Cake Event
* @return \Cake\Http\Response HTTP Response
*/

public function beforeRender(\Cake\Event\EventInterface $event) {
$this->set('vv_base_url', \Cake\Routing\Router::url(
url: "/" . $this->getCOID(),
full: true
));

return parent::beforeRender($event);
}

/**
* Proxy an Agreement on behalf of a Person.
*
Expand Down
6 changes: 3 additions & 3 deletions app/templates/TermsAndConditions/columns.inc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ $rowActions = [
[
'icon' => 'arrow_outward',
'label' => __d('operation', 'visit.tandc'),
'callbackUrl' => function($entity) {
'callbackUrl' => function($entity) use ($vv_base_url) {
// There should always be either a Mostly Static Page or a URL to reference.
if(!empty($entity->mostly_static_page->name)) {
// The T&C is a mostly static page. Provide a link to it.
return '/' . $entity->co_id . '/' . $entity->mostly_static_page->name;
return $vv_base_url . '/' . $entity->mostly_static_page->name;
}
return $entity->url;
}
]
];
];

0 comments on commit 6da4bce

Please sign in to comment.