function rules_php_evaluator_help

Generates help for the PHP actions, conditions and input evaluator.

Related topics

1 call to rules_php_evaluator_help()
RulesPHPEvaluator::help in modules/php.eval.inc
Overrides RulesDataInputEvaluator::help().

File

modules/php.rules.inc, line 125

Code

function rules_php_evaluator_help($var_info, $action_help = FALSE) {
    $render['top'] = array(
        '#prefix' => '<p>',
        '#suffix' => '</p>',
        '#markup' => t('PHP code inside of &lt;?php ?&gt; delimiters will be evaluated and replaced by its output. E.g. &lt;? echo 1+1?&gt; will be replaced by 2.') . ' ' . t('Furthermore you can make use of the following variables:'),
    );
    $render['vars'] = array(
        '#theme' => 'table',
        '#header' => array(
            t('Variable name'),
            t('Type'),
            t('Description'),
        ),
        '#attributes' => array(
            'class' => array(
                'rules-php-help',
            ),
        ),
    );
    $cache = rules_get_cache();
    foreach ($var_info as $name => $info) {
        $row = array();
        $row[] = '$' . check_plain($name);
        $label = isset($cache['data_info'][$info['type']]['label']) ? $cache['data_info'][$info['type']]['label'] : $info['type'];
        $row[] = check_plain(drupal_ucfirst($label));
        $row[] = check_plain($info['label']);
        $render['vars']['#rows'][] = $row;
    }
    if ($action_help) {
        $render['updated_help'] = array(
            '#prefix' => '<p>',
            '#suffix' => '</p>',
            '#markup' => t("If you want to change a variable just return an array of new variable values, e.g.: !code", array(
                '!code' => '<pre>return array("node" => $node);</pre>',
            )),
        );
    }
    return $render;
}