function field_kaltura_textfield_process in Kaltura 6
Same name and namespace in other branches
- 5 plugins/field_kaltura/field_kaltura.module \field_kaltura_textfield_process()
- 6.2 plugins/field_kaltura/field_kaltura.module \field_kaltura_textfield_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 'field_kaltura_textfield_process'
- field_kaltura_elements in plugins/
field_kaltura/ field_kaltura.module - Implementation of FAPI hook_elements().
File
- plugins/
field_kaltura/ field_kaltura.module, line 471 - kaltura integration module - functions to provide kaltura as CCK field
Code
function field_kaltura_textfield_process($element, $edit, $form_state, $form) {
global $_kaltura_thumbnail_base_url;
$field = $form['#field_info'][$element['#field_name']];
$field_key = $element['#columns'][0];
$delta = $element['#delta'];
$custom_name = 'edit-' . str_replace('_', '-', $element['#field_name']) . '-' . $delta . '-' . $field_key;
$element['data'] = array(
'#tree' => 'true',
);
$cw_vars = kaltura_format_cw_vars(array(
'kshow_id' => 0,
'partner_data' => '',
'type' => 'entry',
'context' => 'field',
'field_id' => $custom_name,
));
$action_buttons = '<input type="button" value="Add Kaltura Media" onclick="kalturaInitModalBox(\'' . url('kaltura/contribution_wizard/' . $cw_vars) . '\', {width:680, height:380} );" />';
$field_thumbs = kaltura_get_field_thumbs($element['#value'][$field_key], $custom_name, 'Media', $element['#required']);
$element['data'][$custom_name . '_thumbs'] = array(
'#type' => 'item',
'#value' => '<div id="' . $custom_name . '_thumbs_div">' . $field_thumbs . '</div>',
);
$element['data']['action_buttons'] = array(
'#type' => 'item',
'#value' => $action_buttons,
);
$element[$field_key] = array(
'#type' => 'hidden',
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
'#autocomplete_path' => $element['#autocomplete_path'],
'#size' => !empty($field['widget']['size']) ? $field['widget']['size'] : 60,
'#attributes' => array(
'class' => 'text',
'readonly' => 'readonly',
),
'#readonly' => 'readonly',
// The following values were set by the content module and need
// to be passed down to the nested element.
'#title' => $element['#title'],
'#description' => $element['#description'],
'#required' => $element['#required'],
'#field_name' => $element['#field_name'],
'#type_name' => $element['#type_name'],
'#delta' => $element['#delta'],
'#columns' => $element['#columns'],
);
// Used so that hook_field('validate') knows where to flag an error.
$element['_error_element'] = array(
'#type' => 'value',
'#value' => implode('][', array_merge($element['#parents'], array(
$field_key,
))),
);
return $element;
}