class MigrateMetatagHandler in Metatag 7
Metatag destination handler.
Hierarchy
- class \MigrateHandler
- class \MigrateDestinationHandler
- class \MigrateMetatagHandler
- class \MigrateDestinationHandler
Expanded class hierarchy of MigrateMetatagHandler
1 string reference to 'MigrateMetatagHandler'
- metatag_migrate_api in ./
metatag.migrate.inc - Implements hook_migrate_api().
File
- ./
metatag.migrate.inc, line 86
View source
class MigrateMetatagHandler extends MigrateDestinationHandler {
/**
* Identify a list of supported entity types.
*/
public function __construct() {
$entity_types = metatag_entity_supports_metatags();
$entity_types = array_filter($entity_types);
$entity_types = array_keys($entity_types);
$this
->registerTypes($entity_types);
}
/**
* Implements MigrateDestinationHandler::fields().
*/
public function fields() {
$fields = array();
$elements = metatag_get_info();
foreach ($elements['tags'] as $value) {
$metatag_field = 'metatag_' . $value['name'];
$fields[$metatag_field] = $value['description'];
}
return $fields;
}
/**
* Implements MigrateDestinationHandler::prepare().
*/
public function prepare($entity, stdClass $row) {
$elements = metatag_get_info();
foreach ($elements['tags'] as $value) {
$metatag_field = 'metatag_' . $value['name'];
if (isset($entity->{$metatag_field})) {
$language = isset($entity->language) ? $entity->language : LANGUAGE_NONE;
$entity->metatags[$language][$value['name']]['value'] = $entity->{$metatag_field};
unset($entity->{$metatag_field});
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 | |
MigrateMetatagHandler:: |
public | function | Implements MigrateDestinationHandler::fields(). | |
MigrateMetatagHandler:: |
public | function | Implements MigrateDestinationHandler::prepare(). | |
MigrateMetatagHandler:: |
public | function |
Identify a list of supported entity types. Overrides MigrateHandler:: |