source: sipes/modules_contrib/link/link.migrate.inc @ 6e81fb4

stableversion-3.0
Last change on this file since 6e81fb4 was cd414e9, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se actualizo el modulo

  • Propiedad mode establecida a 100644
File size: 1.2 KB
Línea 
1<?php
2/**
3 * @file
4 * Support for migrate module
5 */
6
7class MigrateLinkFieldHandler extends MigrateFieldHandler {
8  public function __construct() {
9    $this->registerTypes(array('link'));
10  }
11
12  static function arguments($title = NULL, $attributes = NULL, $language = NULL) {
13    $arguments = array();
14    if (!is_null($title)) {
15      $arguments['title'] = $title;
16    }
17    if (!is_null($attributes)) {
18      $arguments['attributes'] = $attributes;
19    }
20    if (!is_null($language)) {
21      $arguments['language'] = $language;
22    }
23    return $arguments;
24  }
25
26  public function prepare($entity, array $instance, array $values) {
27    if (isset($values['arguments'])) {
28      $arguments = $values['arguments'];
29      unset($values['arguments']);
30    }
31    else {
32      $arguments = array();
33    }
34
35    $delta = 0;
36    foreach($values as $value) {
37      $item = array();
38      if (isset($arguments['title'])) {
39        $item['title'] = $arguments['title'];
40      }
41      if (isset($arguments['attributes'])) {
42        $item['attributes'] = $arguments['attributes'];
43      }
44      $item['url'] = $value;
45      $return[$delta] = $item;
46      $delta++;
47    }
48
49    return isset($return) ? $return : NULL;
50  }
51}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.