You are here

function hansel_ui_switch_php_argument_config_form in Hansel breadcrumbs 7

Same name and namespace in other branches
  1. 8 hansel_ui/hansel_ui.module \hansel_ui_switch_php_argument_config_form()

Callback for "PHP code" switch to generate the configuration form.

Parameters

array $arguments:

Return value

array

1 string reference to 'hansel_ui_switch_php_argument_config_form'
hansel_hansel_switch_types in ./hansel.module
Implements hook_hansel_switch_types().

File

hansel_ui/hansel_ui.module, line 754
Hansel UI module

Code

function hansel_ui_switch_php_argument_config_form($arguments) {
  $form = array();
  if (user_access('use PHP for hansel configuration')) {
    $form['php_argument'] = array(
      '#type' => 'textarea',
      '#title' => t('PHP evaluation'),
      '#default_value' => isset($arguments['php_argument']) ? $arguments['php_argument'] : '',
      '#description' => t('PHP code to return the argument. Include %php tags.', array(
        '%php' => '<?php ?>',
      )),
      '#required' => TRUE,
    );
    return hansel_ui_switch_configure_form($form);
  }
  else {
    $form['php_argument'] = array(
      '#type' => 'value',
      '#value' => isset($arguments['php_argument']) ? $arguments['php_argument'] : '',
    );
    $form['php_argument_info'] = array(
      '#type' => 'markup',
      '#value' => t('You don\'t have sufficient permissions to use PHP in Hansel.'),
    );
    return $form;
  }
}