public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $field = empty($this->configuration['field']) ? 'value' : $this->configuration['field'];
    $termName = FALSE;

    /*
     * Depending on the context (whether the plugin is called
     * as a part of an Iterator process, a pipe, or takes its
     * sources from multiple-input Get plugin), we have to check
     * for all value placement variants.
     */
    if (isset($value[$field])) {
      $termName = $value[$field];
    }
    elseif (!empty($row->getSourceProperty($field))) {
      $termName = $row->getSourceProperty($field);
    }
    elseif (is_string($value)) {
      $termName = $value;
    }
    if (!$termName) {
      return $termName;
    }
    // Getting a term by lookup (if it exists), or creating one.
    $term = $this->getTerm($termName, $row, $this->configuration['vocabulary']);
    // Save it.
    $term->save();
    // Yes, all we need is ID.
    return $term->id();
  }
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $field = empty($this->configuration['field']) ? 'value' : $this->configuration['field'];
    $termName = FALSE;

    /*
     * Depending on the context (whether the plugin is called
     * as a part of an Iterator process, a pipe, or takes its
     * sources from multiple-input Get plugin), we have to check
     * for all value placement variants.
     */
    if (isset($value[$field])) {
      $termName = $value[$field];
    }
    elseif (!empty($row->getSourceProperty($field))) {
      $termName = $row->getSourceProperty($field);
    }
    elseif (is_string($value)) {
      $termName = $value;
    }
    if (!$termName) {
      return $termName;
    }
    // Getting a term by lookup (if it exists), or creating one.
    $term = $this->getTerm($termName, $row, $this->configuration['vocabulary']);
    // Save it.
    $term->save();
    // Yes, all we need is ID.
    return $term->id();
  }
public function transform ( $ value , MigrateExecutableInterface $ migrate_executable , Row $ row , $ destination_property ) { $ field = empty ( $ this -> configuration [ 'field' ] ) ? 'value' : $ this -> configuration [ 'field' ] ; $ termName = FALSE ; /*
     * Depending on the context (whether the plugin is called
     * as a part of an Iterator process, a pipe, or takes its
     * sources from multiple-input Get plugin), we have to check
     * for all value placement variants.
     */ if ( isset ( $ value [ $ field ] ) ) { $ termName = $ value [ $ field ] ; } elseif ( ! empty ( $ row -> getSourceProperty ( $ field ) ) ) { $ termName = $ row -> getSourceProperty ( $ field ) ; } elseif ( is_string ( $ value ) ) { $ termName = $ value ; } if ( ! $ termName ) { return $ termName ; } // Getting a term by lookup (if it exists), or creating one. $ term = $ this -> getTerm ( $ termName , $ row , $ this -> configuration [ 'vocabulary' ] ) ; // Save it. $ term -> save ( ) ; // Yes, all we need is ID. return $ term -> id ( ) ; }
The main function for the plugin, actually doing the data conversion.
The main function for the plugin actually doing the data conversion .