home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (content_migrate.optionwidgets.inc)

This example Drupal source code file (content_migrate.optionwidgets.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, break, case, content_migrate_optionwidgets_instance_alter, function, options_onoff, options_select, optionwidgets_onoff, optionwidgets_select, php, replace, string, strtr, switch

The content_migrate.optionwidgets.inc Drupal example source code

 * @file content_migrate.optionwidgets.inc
 * Code to implement hook_content_migrate_field_alter, content_migrate_instance_alter() and content_migrate_data_record_alter()
 * on behalf of the former optionwidgets module, moved into a separate file for efficiency.

 * Implements hook_content_migrate_instance_alter().
 * Use this to tweak the conversion of instance or widget settings
 * from the D6 style to the D7 style for specific
 * situations not handled by basic conversion, as when
 * formatter or widget names or settings are changed.
function content_migrate_optionwidgets_instance_alter(&$instance_value, $field_value) {

  switch ($instance_value['widget']['module']) {
    // Optionswidgets module became Options module
    // and widget type names changed.
    case 'optionwidgets':
      $replace = array(
        'optionwidgets_select' => 'options_select',
        'optionwidgets_buttons' => 'options_buttons',
        'optionwidgets_onoff' => 'options_onoff',
      $instance_value['widget']['module'] = 'options';
      $instance_value['widget']['type'] = strtr($instance_value['widget']['type'], $replace);

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal content_migrate.optionwidgets.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.