You are here

function hook_ctools_math_expression_functions_alter in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 ctools.api.php \hook_ctools_math_expression_functions_alter()

Alter the available functions to be used in ctools math expression api.

One use case would be to create your own function in your module and allow to use it in the math expression api.

Parameters

array $functions: An array which has the functions as value.

array $context: An array containing an item 'final' whose value is a reference to the definitions for multiple-arg functions. Use this to add in functions that require more than one arg.

1 invocation of hook_ctools_math_expression_functions_alter()
ctools_math_expr::__construct in includes/math-expr.inc
Public constructor.

File

./ctools.api.php, line 167
Hooks provided by the Chaos Tool Suite.

Code

function hook_ctools_math_expression_functions_alter(array &$functions, array $context) {

  // Allow to convert from degrees to radians.
  $functions[] = 'deg2rad';
  $multiarg = $context['final'];
  $multiarg['pow'] = array(
    'function' => 'pow',
    'arguments' => 2,
  );
}