You are here

function theme_condition in Rules 6

Renders a condition

File

rules_admin/rules_admin.render.inc, line 81
Rules Admin UI Functions for rendering a rule. If a rule is viewed, it's passed to drupal_get_form so it is rendered with drupal_render().

Code

function theme_condition($element) {
  $attributes = isset($element['#attributes']) ? $element['#attributes'] : array();
  $title = theme('rules_icon', 'condition') . check_plain(rules_get_element_label($element));
  $path = RULES_ADMIN_RULE_PATH . '/' . $element['#rule'] . '/edit/' . $element['#id'];
  $options = array(
    'attributes' => _rules_attributes_add_class($attributes, 'condition'),
    'query' => drupal_get_destination(),
    'html' => TRUE,
  );
  $link = l($title, $path, $options);
  $path = RULES_ADMIN_RULE_PATH . '/' . $element['#rule'] . '/add/op/' . $element['#id'];
  $options['attributes'] = _rules_attributes_add_class($attributes, 'condition_add');
  $indent_link = l(theme_rules_icon('indent', t('Indent this condition by adding a logical operation.')), $path, $options);
  $print_op = $element['#negate'] ? theme('rules_logical_operation_label', 'not', t('NOT')) . ' ' : '';
  return $print_op . $link . ' ' . $indent_link;
}