You are here

class MigrateNodewordsNodeHandler in Migrate Extras 6.2

@file Support for importing META information into the Nodewords module.

Hierarchy

Expanded class hierarchy of MigrateNodewordsNodeHandler

1 string reference to 'MigrateNodewordsNodeHandler'
migrate_extras_migrate_api in ./migrate_extras.module

File

./nodewords.inc, line 8
Support for importing META information into the Nodewords module.

View source
class MigrateNodewordsNodeHandler extends MigrateDestinationHandler {
  public function __construct() {
    $this
      ->registerTypes(array(
      'node',
    ));
  }

  /**
   * Make the destination fields visible. Prefixes added to avoid potential
   * conflict with other modules.
   */
  public function fields() {
    if (module_exists('nodewords')) {
      return array(
        'nodewords_abstract' => t('Nodewords: Abstract'),
        'nodewords_canonical' => t('Nodewords: Canonical'),
        'nodewords_copyright' => t('Nodewords: Copyright'),
        'nodewords_description' => t('Nodewords: Description'),
        'nodewords_keywords' => t('Nodewords: Keywords'),
        'nodewords_revisit-after' => t('Nodewords: Revisit After'),
        'nodewords_robots' => t('Nodewords: Robots'),
      );
    }
    else {
      return array();
    }
  }

  /**
   * Move the nodewords fields into the appropriate structure for the nodewords
   * module to handle them on update/insert.
   */
  public function prepare($node, stdClass $row) {
    if (module_exists('nodewords')) {
      foreach ($this
        ->fields() as $full_field => $label) {
        if (isset($node->{$full_field})) {
          $field = substr($full_field, strlen('nodewords_'));
          $node->nodewords[$field]['value'] = $node->{$full_field};
          unset($node->{$full_field});
        }
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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?
MigrateHandler::registerTypes protected function Register a list of types handled by this class
MigrateNodewordsNodeHandler::fields public function Make the destination fields visible. Prefixes added to avoid potential conflict with other modules.
MigrateNodewordsNodeHandler::prepare public function Move the nodewords fields into the appropriate structure for the nodewords module to handle them on update/insert.
MigrateNodewordsNodeHandler::__construct public function Overrides MigrateHandler::__construct