You are here

abstract class MigrateFieldHandler in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/destinations/fields.inc \MigrateFieldHandler

Hierarchy

Expanded class hierarchy of MigrateFieldHandler

3 string references to 'MigrateFieldHandler'
MigrateFieldsEntityHandler::fields in plugins/destinations/fields.inc
Implementation of MigrateDestinationHandler::fields().
migrate_field_handler_invoke_all in ./migrate.module
Invoke any available handlers attached to a given field type.
migrate_ui_configure_form in migrate_ui/migrate_ui.pages.inc
Form for reviewing migrations.

File

plugins/destinations/fields.inc, line 111
Support for processing entity fields

View source
abstract class MigrateFieldHandler extends MigrateHandler {

  // Derived classes are expected to implement one
  // or both of the prepare/complete handlers.
  // Abstract public function
  // prepare($entity, array $field_info, array $instance, array $values).
  // Abstract public function
  // complete($entity, array $field_info, array $instance, array $values).

  /**
   * Determine the language of the field.
   *
   * @param $entity
   * @param $field_info
   * @param $arguments
   *
   * @return string language code.
   */
  function getFieldLanguage($entity, $field_info, array $arguments) {
    $migration = Migration::currentMigration();
    switch (TRUE) {
      case !field_is_translatable($migration
        ->getDestination()
        ->getEntityType(), $field_info):
        return LANGUAGE_NONE;
      case isset($arguments['language']):
        return $arguments['language'];
      case !empty($entity->language) && $entity->language != LANGUAGE_NONE:
        return $entity->language;
        break;
      default:
        return $migration
          ->getDestination()
          ->getLanguage();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MigrateFieldHandler::getFieldLanguage function Determine the language of the field.
MigrateHandler::$dependencies protected property List of other handler classes which should be invoked before the current one.
MigrateHandler::$typesHandled protected property List of "types" handled by this handler. Depending on the kind of handler, these may be destination types, field types, etc.
MigrateHandler::getDependencies public function
MigrateHandler::getTypesHandled public function
MigrateHandler::handlesType public function Does this handler handle the given type? 1
MigrateHandler::registerTypes protected function Register a list of types handled by this class
MigrateHandler::__construct abstract public function 11