afform_html - Add skeletal page civicrm/admin/afform/html
authorTim Otten <totten@civicrm.org>
Sat, 4 May 2019 03:59:04 +0000 (20:59 -0700)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
ext/afform/html/CRM/AfformHtml/Page/HtmlEditor.php [new file with mode: 0644]
ext/afform/html/templates/CRM/AfformHtml/Page/HtmlEditor.tpl [new file with mode: 0644]
ext/afform/html/xml/Menu/afform_html.xml [new file with mode: 0644]

diff --git a/ext/afform/html/CRM/AfformHtml/Page/HtmlEditor.php b/ext/afform/html/CRM/AfformHtml/Page/HtmlEditor.php
new file mode 100644 (file)
index 0000000..d2bd593
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+use CRM_AfformHtml_ExtensionUtil as E;
+
+class CRM_AfformHtml_Page_HtmlEditor extends CRM_Core_Page {
+
+  public function run() {
+    // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
+    CRM_Utils_System::setTitle(E::ts('HtmlEditor'));
+
+    // Example: Assign a variable for use in a template
+    $this->assign('currentTime', date('Y-m-d H:i:s'));
+
+    parent::run();
+  }
+
+}
diff --git a/ext/afform/html/templates/CRM/AfformHtml/Page/HtmlEditor.tpl b/ext/afform/html/templates/CRM/AfformHtml/Page/HtmlEditor.tpl
new file mode 100644 (file)
index 0000000..5ce6525
--- /dev/null
@@ -0,0 +1,7 @@
+<h3>This new page is generated by CRM/AfformHtml/Page/HtmlEditor.php</h3>
+
+{* Example: Display a variable directly *}
+<p>The current time is {$currentTime}</p>
+
+{* Example: Display a translated string -- which happens to include a variable *}
+<p>{ts 1=$currentTime}(In your native language) The current time is %1.{/ts}</p>
diff --git a/ext/afform/html/xml/Menu/afform_html.xml b/ext/afform/html/xml/Menu/afform_html.xml
new file mode 100644 (file)
index 0000000..bf56e37
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<menu>
+  <item>
+    <path>civicrm/admin/afform/html</path>
+    <page_callback>CRM_AfformHtml_Page_HtmlEditor</page_callback>
+    <title>HtmlEditor</title>
+    <access_arguments>administer CiviCRM</access_arguments>
+  </item>
+</menu>