You are here

function _emfield_field_submit_id in Embedded Media Field 6

Same name and namespace in other branches
  1. 5 emfield.module \_emfield_field_submit_id()
  2. 6.3 deprecated/emfield-deprecated.inc \_emfield_field_submit_id()
  3. 6.2 emfield.module \_emfield_field_submit_id()

Replace embedded code with the extracted id. this goes in the field 'value'. This also allows you to grab directly from the URL to display the content from field 'provider'.

3 calls to _emfield_field_submit_id()
emfield_content_generate in ./emfield.module
Implementation of Devel module's hook_content_generate().
_emfield_emfield_field in ./emfield.cck.inc
Implementation of hook_emfield_field(). This in turn is a callback for hook_field().
_emfield_field_validate_id in ./emfield.module
Extract the id from embedded code or url.

File

./emfield.module, line 190
Embedded Media Field is a CCK-based framework for 3rd party media files.

Code

function _emfield_field_submit_id($field, $item, $module) {

  // @TODO Find the right fix for this.
  // When the embedded media field is used in the default value widget
  // when editing field settings, the $item has no value for 'provider',
  // causing an error message.
  // This is not the right way to fix this, but I don't know why that
  // value has been left out of the form element returned by hook_widget_settings
  // and this will at least keep the error message from being displayed.
  if (!isset($item['provider'])) {
    $item['provider'] = '';
  }
  $item = array_merge($item, emfield_parse_embed($field, $item['embed'], $module));
  $item['data'] = (array) emfield_include_invoke($module, $item['provider'], 'data', $field, $item);
  $item['version'] = intval(emfield_include_invoke($module, $item['provider'], 'data_version', $field, $item));
  return $item;
}