Commit 89531573 authored by dawehner's avatar dawehner Committed by tim.plunkett

Convert the math field to use the PSR-0 class.

parent c7763678
......@@ -5,6 +5,8 @@
* Definition of views_handler_field_math.
*/
use Drupal\ctools\MathExpression;
/**
* Render a mathematical expression as a numeric value
*
......@@ -41,11 +43,10 @@ function options_form(&$form, &$form_state) {
}
function render($values) {
ctools_include('math-expr');
$tokens = array_map('floatval', $this->get_render_tokens(array()));
$value = strtr($this->options['expression'], $tokens);
$expressions = explode(';', $value);
$math = new ctools_math_expr;
$math = new MathExpression();
foreach ($expressions as $expression) {
if ($expression !== '') {
$value = $math->evaluate($expression);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment