class MigrateImageFieldHandler in Migrate 7.2
Handle for image fields;
Hierarchy
- class \MigrateHandler
- class \MigrateFieldHandler
- class \MigrateFileFieldBaseHandler
- class \MigrateImageFieldHandler
- class \MigrateFileFieldBaseHandler
- class \MigrateFieldHandler
Expanded class hierarchy of MigrateImageFieldHandler
1 string reference to 'MigrateImageFieldHandler'
File
- plugins/
destinations/ fields.inc, line 865 - Support for processing entity fields
View source
class MigrateImageFieldHandler extends MigrateFileFieldBaseHandler {
public function __construct() {
$this
->registerTypes(array(
'image',
));
}
/**
* Implementation of MigrateFieldHandler::fields().
* Note that file and image fields support slightly different field lists.
*
* @param $type
* The file field type - 'file' or 'image'
* @param $instance
* Instance info for the field.
* @param Migration $migration
* The migration context for the parent field. We can look at the mappings
* and determine which subfields are relevant.
*
* @return array
*/
public function fields($type, $instance, $migration = NULL) {
$fields = parent::fields($type, $instance, $migration);
$fields += array(
'alt' => t('Subfield: <a href="@doc">String to be used as the alt value</a>', array(
'@doc' => 'http://drupal.org/node/1224042#alt',
)),
'title' => t('Subfield: <a href="@doc">String to be used as the title value</a>', array(
'@doc' => 'http://drupal.org/node/1224042#title',
)),
);
return $fields;
}
/**
* Implementation of MigrateFileFieldBaseHandler::buildFieldArray().
*/
protected function buildFieldArray($field_array, $arguments, $delta) {
if (isset($arguments['alt'])) {
if (is_array($arguments['alt'])) {
$field_array['alt'] = $arguments['alt'][$delta];
}
else {
$field_array['alt'] = $arguments['alt'];
}
}
if (isset($arguments['title'])) {
if (is_array($arguments['title'])) {
$field_array['title'] = $arguments['title'][$delta];
}
else {
$field_array['title'] = $arguments['title'];
}
}
return $field_array;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MigrateFieldHandler:: |
function | Determine the language of the field. | ||
MigrateFileFieldBaseHandler:: |
protected | function | Determine where the migrated file should go. | |
MigrateFileFieldBaseHandler:: |
public | function | Implementation of MigrateFieldHandler::prepare(). | |
MigrateHandler:: |
protected | property | List of other handler classes which should be invoked before the current one. | |
MigrateHandler:: |
protected | property | List of "types" handled by this handler. Depending on the kind of handler, these may be destination types, field types, etc. | |
MigrateHandler:: |
public | function | ||
MigrateHandler:: |
public | function | ||
MigrateHandler:: |
public | function | Does this handler handle the given type? | 1 |
MigrateHandler:: |
protected | function | Register a list of types handled by this class | |
MigrateImageFieldHandler:: |
protected | function |
Implementation of MigrateFileFieldBaseHandler::buildFieldArray(). Overrides MigrateFileFieldBaseHandler:: |
|
MigrateImageFieldHandler:: |
public | function |
Implementation of MigrateFieldHandler::fields().
Note that file and image fields support slightly different field lists. Overrides MigrateFileFieldBaseHandler:: |
|
MigrateImageFieldHandler:: |
public | function |
Overrides MigrateHandler:: |