From 254f01f028381fe8a83b8f54d37d799125c4c3ee Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Wed, 28 Nov 2018 16:38:11 -0500 Subject: [PATCH] Add support for the is_public flag on front-end forms --- ext/afform/CRM/Afform/AfformScanner.php | 1 + ext/afform/afform.php | 3 ++- ext/afform/docs/quickstart.md | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/afform/CRM/Afform/AfformScanner.php b/ext/afform/CRM/Afform/AfformScanner.php index 03cc44642d..02afccef45 100644 --- a/ext/afform/CRM/Afform/AfformScanner.php +++ b/ext/afform/CRM/Afform/AfformScanner.php @@ -131,6 +131,7 @@ class CRM_Afform_AfformScanner { 'requires' => explode(',', self::DEFAULT_REQUIRES), 'title' => '', 'description' => '', + 'is_public' => false, ]; return array_merge($defaults, json_decode(file_get_contents($metaFile), 1)); diff --git a/ext/afform/afform.php b/ext/afform/afform.php index 9690db244c..9ac61b2f54 100644 --- a/ext/afform/afform.php +++ b/ext/afform/afform.php @@ -212,7 +212,8 @@ function afform_civicrm_alterMenu(&$items) { 'page_callback' => 'CRM_Afform_Page_AfformBase', 'page_arguments' => 'afform=' . urlencode($name), 'title' => CRM_Utils_Array::value('title', $meta, ''), - 'access_arguments' => [['access CiviCRM'], 'and'] // FIXME + 'access_arguments' => [['access CiviCRM'], 'and'], // FIXME + 'is_public' => $meta['is_public'], ]; } } diff --git a/ext/afform/docs/quickstart.md b/ext/afform/docs/quickstart.md index d3c47063a1..d67ffc51fc 100644 --- a/ext/afform/docs/quickstart.md +++ b/ext/afform/docs/quickstart.md @@ -14,7 +14,7 @@ $ cv flush A few things to note: -* We defined a route `civicrm/hello-world`. This is defined in the same routing system used by CiviCRM forms. +* We defined a route `civicrm/hello-world`. This is defined in the same routing system used by CiviCRM forms. It also supports properties such as `title` (page title) and `is_public` (defaults to `false`). * The file `layout.html` is an AngularJS HTML document. It has access to all the general features of Angular HTML (discussed more later). * After creating a new form or file, we should flush the cache. * If you're going to actively edit/revise the content of the file, then you should navigate -- 2.25.1