You are here

DisqusEntityId.php in Disqus 8

File

src/Plugin/migrate/process/DisqusEntityId.php
View source
<?php

namespace Drupal\disqus\Plugin\migrate\process;

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

/**
 * Gives the entity_id from the disqus identifier.
 *
 * @MigrateProcessPlugin(
 *   id = "disqus_comment_entity_id"
 * )
 */
class DisqusEntityId extends ProcessPluginBase {

  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $id_parts = explode("/", $value);
    if (!isset($id_parts[1])) {
      throw new MigrateSkipRowException();
    }
    return $id_parts[1];
  }

}

Classes

Namesort descending Description
DisqusEntityId Gives the entity_id from the disqus identifier.