You are here

function blockreference_select_sort_process in Block reference 6

Same name and namespace in other branches
  1. 7 blockreference.module \blockreference_select_sort_process()

Process an individual element.

Build the form element. When creating a form using FAPI #process, note that $element['#value'] is already set.

The $fields array is in $form['#field_info'][$element['#field_name']].

1 string reference to 'blockreference_select_sort_process'
blockreference_elements in ./blockreference.module
Implementation of FAPI hook_elements().

File

./blockreference.module, line 531
Defines a field type for referencing a block from a node.

Code

function blockreference_select_sort_process($element, $edit, $form_state, $form) {
  $field = $form['#field_info'][$element['#field_name']];
  $field_key = $element['#columns'][0];
  $element[$field_key] = array(
    '#type' => 'select',
    '#options' => blockreference_allowed_values($field),
    '#multiple' => 0,
    '#default_value' => isset($element['#value'][$element['#columns'][0]]) ? $element['#value'][$element['#columns'][0]] : '',
    // The following values were set by the content module and need
    // to be passed down to the nested element.
    '#field_name' => $element['#field_name'],
    '#delta' => $element['#delta'],
    '#columns' => $element['#columns'],
    '#title' => $element['#title'],
    '#required' => $element['#required'],
    '#description' => $element['#description'],
  );
  return $element;
}