From 1a3929bf7b98d6959aec8954521be794bdce58a6 Mon Sep 17 00:00:00 2001 From: Arlen Johnson Date: Wed, 29 Mar 2023 14:26:06 -0400 Subject: [PATCH] Add test for whether an "add" link should be included in the index view (CO-2585) --- app/templates/Standard/index.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 59215435..41f02dda 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -222,12 +222,14 @@ function _column_key($modelsName, $c, $tz=null) { $addLink = $addLinkFilter($addLink, $this->request); } - $action_args['vv_actions'][] = array( - 'order' => $this->Menu->getMenuOrder('Add'), - 'icon' => $this->Menu->getMenuIcon('Add'), - 'url' => $this->Url->build($addLink), - 'label' => __('match.op.add.a', __('match.ct.'.$vv_modelname, [1])) - ); + if($addLink) { + $action_args['vv_actions'][] = array( + 'order' => $this->Menu->getMenuOrder('Add'), + 'icon' => $this->Menu->getMenuIcon('Add'), + 'url' => $this->Url->build($addLink), + 'label' => __('match.op.add.a', __('match.ct.'.$vv_modelname, [1])) + ); + } // Output the topLinks if(!empty($action_args['vv_actions'])) {