path.inc 602 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * @file
  4. * Support for paths in core Drupal objects
  5. */
  6. class MigratePathEntityHandler extends MigrateDestinationHandler {
  7. public function __construct() {
  8. $this->registerTypes(array('entity'));
  9. }
  10. public function fields() {
  11. if (module_exists('path')) {
  12. return array('path' => t('Node: Path alias'));
  13. }
  14. else {
  15. return array();
  16. }
  17. }
  18. public function prepare($entity, stdClass $row) {
  19. if (module_exists('path') && isset($entity->path)) {
  20. $path = $entity->path;
  21. $entity->path = array();
  22. $entity->path['alias'] = $path;
  23. }
  24. }
  25. }