You are here

private function CalculateValue::getFormulaDescription in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Plugin/BusinessRulesAction/CalculateValue.php \Drupal\business_rules\Plugin\BusinessRulesAction\CalculateValue::getFormulaDescription()

Get the formula description.

Return value

array The render array.

1 call to CalculateValue::getFormulaDescription()
CalculateValue::getSettingsForm in src/Plugin/BusinessRulesAction/CalculateValue.php
Return the form array.

File

src/Plugin/BusinessRulesAction/CalculateValue.php, line 59

Class

CalculateValue
Class CalculateValue.

Namespace

Drupal\business_rules\Plugin\BusinessRulesAction

Code

private function getFormulaDescription() {
  $rows[] = [
    'example' => '{{variable_a}} + {{variable_b}}',
    'name' => t('Addition'),
    'result' => t('Sum of {{variable_a}} and {{variable_b}}'),
  ];
  $rows[] = [
    'example' => '{{variable_a}} - {{variable_b}}',
    'name' => t('Subtraction'),
    'result' => t('Difference of {{variable_a}} and {{variable_b}}'),
  ];
  $rows[] = [
    'example' => '{{variable_a}} * {{variable_b}}',
    'name' => t('Multiplication'),
    'result' => t('Product of {{variable_a}} and {{variable_b}}'),
  ];
  $rows[] = [
    'example' => '{{variable_a}} / {{variable_b}}',
    'name' => t('Division'),
    'result' => t('Quotient of {{variable_a}} and {{variable_b}}'),
  ];
  $rows[] = [
    'example' => '{{variable_a}} % {{variable_b}}',
    'name' => t('Modulo'),
    'result' => t('Remainder of {{variable_a}} divided by {{variable_b}}'),
  ];
  $rows[] = [
    'example' => '{{variable_a}} ** {{variable_b}}',
    'name' => t('Exponentiation'),
    'result' => t('Result of raising {{variable_a}} to the {{variable_b}}. PHP 5.6 and over.'),
  ];
  $rows[] = [
    'example' => '({{variable_a}} + {{variable_b}}) + {{variable_c}}',
    'name' => t('Parenthesis'),
    'result' => t('Change the precedence of the mathematical equation.'),
  ];
  $table = [
    '#type' => 'table',
    '#header' => [
      'example' => t('Example'),
      'name' => t('Name'),
      'result' => t('Result'),
    ],
    '#rows' => $rows,
  ];
  $output['help'] = [
    '#type' => 'details',
    '#title' => t('Formula helper'),
    '#collapsed' => TRUE,
  ];
  $output['help']['content'] = $table;
  return $output;
}