Skip to content

Commit

Permalink
#6 [Substitutons] add: tinyurl_completesubstitutionarray for use __TI…
Browse files Browse the repository at this point in the history
…NY_URL_LINK__ in mail or sms template
  • Loading branch information
nicolas-eoxia committed Aug 3, 2023
1 parent 8874fbe commit 3d4c7e3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/modules/modTinyURL.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function __construct($db)
// Set this to 1 if module has its own login method file (core/login)
'login' => 0,
// Set this to 1 if module has its own substitution function file (core/substitutions)
'substitutions' => 0,
'substitutions' => 1,
// Set this to 1 if module has its own menus handler directory (core/menus)
'menus' => 0,
// Set this to 1 if module overwrite template dir (core/tpl)
Expand Down
43 changes: 43 additions & 0 deletions core/substitutions/functions_tinyurl.lib.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/* Copyright (C) 2023 EVARISK <technique@evarisk.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/

/**
* \file core/substitutions/functions_tinyurl.lib.php
* \ingroup functions_tinyurl
* \brief File of functions to substitutions array
*/

/** Function called to complete substitution array (before generating on ODT, or a personalized email)
* functions xxx_completesubstitutionarray are called by make_substitutions() if file
* is inside directory htdocs/core/substitutions
*
* @param array $substitutionarray Array with substitution key => val
* @param Translate $langs Output langs
* @param Object $object Object to use to get values
* @return void The entry parameter $substitutionarray is modified
*/
function tinyurl_completesubstitutionarray(&$substitutionarray, $langs, $object)
{
switch ($object->element) {
case 'propal':
case 'commande':
case 'facture':
$substitutionarray['__TINY_URL_LINK__'] = $object->array_options['options_tiny_url_link'];
break;
}
}
2 changes: 2 additions & 0 deletions core/substitutions/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
//Silence is golden

0 comments on commit 3d4c7e3

Please sign in to comment.