3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * Replace the value of an attribute in the input string. Assume
20 * the the attribute is well formed, of the type name="value". If
21 * no replacement is mentioned the value is inserted at the end of
24 * @param string $string
25 * The html to be tweaked with.
26 * @param string $attribute
27 * The attribute to insert.
28 * @param string $value
29 * The new attribute value.
30 * @param string $insertBefore
31 * The string before which we want this tag inserted.
34 * the new modified html string
36 function smarty_modifier_crmInsert($string, $attribute, $value, $insertBefore = '/>') {
37 return str_replace($insertBefore, ' ' . $attribute . '="' . $value . '"' . $insertBefore, $string);