You are here

class MigrateLinkFieldHandler in Link 6.2

Same name and namespace in other branches
  1. 7 link.migrate.inc \MigrateLinkFieldHandler

@file Support for migrate module

Hierarchy

Expanded class hierarchy of MigrateLinkFieldHandler

File

./link.migrate.inc, line 7
Support for migrate module

View source
class MigrateLinkFieldHandler extends MigrateFieldHandler {
  public function __construct() {
    $this
      ->registerTypes(array(
      'link',
    ));
  }
  static function arguments($title = NULL, $attributes = NULL, $language = NULL) {
    $arguments = array();
    if (!is_null($title)) {
      $arguments['title'] = $title;
    }
    if (!is_null($attributes)) {
      $arguments['attributes'] = $attributes;
    }
    if (!is_null($language)) {
      $arguments['language'] = $language;
    }
    return $arguments;
  }
  public function prepare($entity, array $instance, array $values) {
    if (isset($values['arguments'])) {
      $arguments = $values['arguments'];
      unset($values['arguments']);
    }
    else {
      $arguments = array();
    }
    $delta = 0;
    foreach ($values as $value) {
      $item = array();
      if (isset($arguments['title'])) {
        $item['title'] = $arguments['title'];
      }
      if (isset($arguments['attributes'])) {
        $item['attributes'] = $arguments['attributes'];
      }
      $item['url'] = $value;
      $return[$delta] = $item;
      $delta++;
    }
    return isset($return) ? $return : NULL;
  }

}

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
MigrateLinkFieldHandler::arguments static function
MigrateLinkFieldHandler::prepare public function
MigrateLinkFieldHandler::__construct public function Overrides MigrateHandler::__construct