class WeightNodeHandler in Weight 7.2
Hierarchy
- class \MigrateHandler
- class \MigrateDestinationHandler
- class \WeightNodeHandler
- class \MigrateDestinationHandler
Expanded class hierarchy of WeightNodeHandler
1 string reference to 'WeightNodeHandler'
- weight_migrate_api in ./
weight.migrate.inc - Implements hook_migrate_api().
File
- ./
weight.migrate.inc, line 20 - Migrate support for weight.
View source
class WeightNodeHandler extends MigrateDestinationHandler {
public function __construct() {
$this
->registerTypes(array(
'node',
));
}
public function fields($entity_type, $bundle) {
$settings = _weight_get_settings($bundle);
if (!empty($settings) && $settings['enabled']) {
return array(
'weight' => t('The node weight ranging between @min and @max.', array(
'@max' => $settings['range'],
'@min' => (int) $settings['range'] * -1,
)),
);
}
}
public function prepare($entity, stdClass $row) {
$settings = _weight_get_settings($entity->type);
if (!empty($settings) && $settings['enabled']) {
// Use the mapped entity value to populate the real value
if (isset($entity->weight)) {
$entity->weight_weight = $entity->weight;
unset($entity->weight);
}
else {
$entity->weight_weight = $settings['default'];
}
}
}
}
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 | |
WeightNodeHandler:: |
public | function | ||
WeightNodeHandler:: |
public | function | ||
WeightNodeHandler:: |
public | function |
Overrides MigrateHandler:: |