usebb2drupal-8.x-1.0-rc1/src/Plugin/migrate/process/PostEditTime.php

src/Plugin/migrate/process/PostEditTime.php
<?php

namespace Drupal\usebb2drupal\Plugin\migrate\process;

use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;

/**
 * Calculate post edit time from edit or creation timestamp.
 *
 * @MigrateProcessPlugin(
 *   id = "usebb_post_edit_time"
 * )
 */
class PostEditTime extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (empty($value) && $row->hasSourceProperty('post_time')) {
      $value = $row->getSourceProperty('post_time');
    }
    return $value;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc