function iframe_content_migrate_field_alter in Iframe 7
Implements hook_content_migrate_field_alter().
Use this to tweak the conversion of field settings from the D6 style to the D7 style for specific situations not handled by basic conversion, as when field types or settings are changed.
1 string reference to 'iframe_content_migrate_field_alter'
- iframe_init in ./
iframe.module - Support for local-domain iframes and autoresize the height
File
- ./
iframe.content_migrate.iframe.inc, line 15 - iframe.content_migrate.iframe.inc Code to implement Content Migrate hooks on behalf of the Iframe module.
Code
function iframe_content_migrate_field_alter(&$field_value, $instance_value) {
// deal only with iframe fields
if ($field_value['module'] == 'iframe') {
#iframe_debug(0, 'iframe_content_migrate_field_alter', array($field_value, $instance_value));
#$field_value['messages'][] = t("Changed field type: The '@field' field type will be changed from '@type' to 'iframe'.", array('@type' => $field_value['type'], '@field' => $field_value['field_name'], '@widget' => $instance_value['widget']['type']));
$field_value['module'] = 'iframe';
$field_value['type'] = 'iframe';
// settings are now a field settings.
if (isset($field_value['settings']) && is_array($field_value['settings']['attributes'])) {
$default_attributes = array();
foreach (array(
'class',
'width',
'height',
'frameborder',
'scrolling',
'transparency',
'tokensupport',
) as $attr) {
if (isset($field_value['settings']['attributes'][$attr])) {
$field_value['settings'][$attr] = $field_value['settings']['attributes'][$attr];
$default_attributes[$attr] = $field_value['settings']['attributes'][$attr];
}
}
unset($field_value['settings']['attributes']);
$field_value['messages'][] = t("Transfer of default attributes: The '@field' will get following default attributes: @attributes", array(
'@field' => $field_value['field_name'],
'@widget' => $instance_value['widget']['type'],
'@attributes' => print_r($default_attributes, TRUE),
));
}
}
}