You are here

function media_field_widget_value in D7 Media 7

Same name and namespace in other branches
  1. 7.4 includes/media.fields.inc \media_field_widget_value()
  2. 7.2 includes/media.fields.inc \media_field_widget_value()
  3. 7.3 includes/media.fields.inc \media_field_widget_value()

@todo Is this function ever called? If not, remove it. The Field API now supports automatic serialization / unserialization, so this should no longer be needed. After verifying with a module that uses the 'data' column, remove this.

See also

media_field_widget_form()

File

includes/media.fields.inc, line 358
: Provides a "Multimedia asset" field to the fields API

Code

function media_field_widget_value($element, $input, $form_state) {
  $return = $input;
  if (!is_array($return)) {
    $return = array();
  }
  if (isset($return['data'])) {
    $return['data'] = serialize($return['data']);
  }
  $return += array(
    'fid' => 0,
    'title' => '',
    'data' => NULL,
  );
  return $return;
}