diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index e3e654228..e42c7d582 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -387,6 +387,9 @@ msgstr "View" msgid "view.a" msgstr "View {0}" +msgid "visit.msp" +msgstr "Visit Page" + msgid "visit.link" msgstr "Visit link" diff --git a/app/templates/MostlyStaticPages/columns.inc b/app/templates/MostlyStaticPages/columns.inc index 86f962bac..533162acb 100644 --- a/app/templates/MostlyStaticPages/columns.inc +++ b/app/templates/MostlyStaticPages/columns.inc @@ -45,3 +45,13 @@ $indexColumns = [ 'sortable' => true ] ]; + +$rowActions = [ + [ + 'icon' => 'arrow_outward', + 'label' => __d('operation', 'visit.msp'), + 'url' => function($entity) { + return '/' . $entity->co_id . '/' . $entity->name; + } + ] +]; diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index bb72c437c..bc86da373 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -284,12 +284,23 @@ $actionOrderDefault = $this->Menu->getMenuOrder('Default'); foreach ($rowActions as $a) { $ok = false; + $callbackUrl = ''; + if (!empty($a['controller']) && $a['controller'] != $tableName) { $relTableName = Inflector::camelize($a['controller']); if (isset($vv_permission_set[$entity->id][$relTableName][$a['action']])) { $ok = $vv_permission_set[$entity->id][$relTableName][$a['action']]; } + } elseif(!empty($a['url'])) { + if(is_callable($a['url'])) { + // We are constructing a URL in a callback function. + $callbackUrl = $a['url']($entity); + } else { + // We are setting a static URL override. + $callbackUrl = $a['url']; + } + $ok = true; } else { $ok = $vv_permission_set[$entity->id][$a['action']]; } @@ -306,7 +317,7 @@ $actionIcon = !empty($a['icon']) ? $a['icon'] : $this->Menu->getMenuIcon('Default'); $actionIconClass = !empty($a['iconClass']) ? $a['iconClass'] : ''; $actionClass = !empty($a['class']) ? $a['class'] : ''; - $actionUrl = ['action' => $a['action'], $entity->id]; + $actionUrl = !empty($callbackUrl) ? $callbackUrl : ['action' => $a['action'], $entity->id]; $actionLabel = !empty($a['label']) ? $a['label'] : __d('operation', $a['action']); if (!empty($a['controller']) && $a['controller'] != $tableName) {