You are here

function _webform_render_matrix in Webform Matrix Component 7.4

Same name and namespace in other branches
  1. 6 components/matrix.inc \_webform_render_matrix()
  2. 7 components/matrix.inc \_webform_render_matrix()
  3. 7.2 components/matrix.inc \_webform_render_matrix()
  4. 7.3 components/matrix.inc \_webform_render_matrix()

Implements _webform_render_component().

File

components/matrix.inc, line 427
Webform module matrix component.

Code

function _webform_render_matrix($component, $value = NULL, $filter = TRUE) {
  $node = isset($component['nid']) ? node_load($component['nid']) : NULL;
  $element = array();
  $element['#weight'] = $component['weight'];
  $element['#webform_component'] = $component;
  $element['#component_value'] = $value;
  $element['#title'] = $filter ? webform_filter_xss($component['name']) : $component['name'];
  if (isset($component['extra']['description'])) {
    $element['#description'] = $filter ? webform_filter_descriptions($component['extra']['description'], $node) : $component['extra']['description'];
  }
  if ($component['extra']['title_display'] != 0) {
    $element['value'] = array(
      '#markup' => "<label>" . _webform_filter_xss($component['name']) . "</label>",
    );
  }
  $element['#translatable'] = array(
    'title',
    'description',
  );
  return $element;
}