MDL-70237 payment: Allow html tags in gateway description
authorShamim Rezaie <shamim@moodle.com>
Mon, 16 Nov 2020 10:37:45 +0000 (21:37 +1100)
committerShamim Rezaie <shamim@moodle.com>
Wed, 18 Nov 2020 12:25:06 +0000 (23:25 +1100)
payment/classes/external/get_available_gateways.php
payment/gateway/paypal/db/install.php
payment/templates/gateway.mustache

index b8a1abf..b926a3f 100644 (file)
@@ -96,7 +96,7 @@ class get_available_gateways extends external_api {
                 new external_single_structure([
                     'shortname' => new external_value(PARAM_PLUGIN, 'Name of the plugin'),
                     'name' => new external_value(PARAM_TEXT, 'Human readable name of the gateway'),
-                    'description' => new external_value(PARAM_TEXT, 'description of the gateway'),
+                    'description' => new external_value(PARAM_RAW, 'description of the gateway'),
                     'surcharge' => new external_value(PARAM_INT, 'percentage of surcharge when using the gateway'),
                     'cost' => new external_value(PARAM_TEXT,
                         'Cost in human-readable form (amount plus surcharge with currency sign)'),
index f9ca2d6..59db989 100644 (file)
@@ -23,6 +23,8 @@
  */
 
 function xmldb_paygw_paypal_install() {
+    global $CFG;
+
     // Enable the Paypal payment gateway on installation. It still needs to be configured and enabled for accounts.
     $order = (!empty($CFG->paygw_plugins_sortorder)) ? explode(',', $CFG->paygw_plugins_sortorder) : [];
     set_config('paygw_plugins_sortorder', join(',', array_merge($order, ['paypal'])));
index 4189f9f..fed351f 100644 (file)
@@ -45,7 +45,7 @@
     <input class="custom-control-input" type="radio" name="payby" id="id-payby-{{uniqid}}-{{shortname}}" data-cost="{{cost}}" data-surcharge="{{surcharge}}" value="{{shortname}}" {{#checked}} checked="checked" {{/checked}} />
     <label class="custom-control-label bg-light border p-3 my-3" for="id-payby-{{uniqid}}-{{shortname}}">
         <p class="h3">{{name}}</p>
-        <p class="content mb-2">{{description}}</p>
+        <p class="content mb-2">{{{description}}}</p>
         {{#pix}} img, paygw_{{shortname}} {{/pix}}
     </label>
 </div>
\ No newline at end of file