You are here

public function PrivateContentSettings::import in Private content 8.2

Import the row.

Derived classes must implement import(), to construct one new object (pre-populated) using ID mappings in the Migration.

Parameters

\Drupal\migrate\Row $row: The row object.

array $old_destination_id_values: (optional) The old destination IDs. Defaults to an empty array.

Return value

array|bool An indexed array of destination IDs in the same order as defined in the plugin's getIds() method if the plugin wants to save the IDs to the ID map, TRUE to indicate success without saving IDs to the ID map, or FALSE to indicate a failure.

Overrides MigrateDestinationInterface::import

File

src/Plugin/migrate/destination/d6/PrivateContentSettings.php, line 25

Class

PrivateContentSettings
Imports private content type settings.

Namespace

Drupal\private_content\Plugin\migrate\destination\d6

Code

public function import(Row $row, array $old_destination_id_values = array()) {
  $node_type = $row
    ->getSourceProperty('type');
  $private = $row
    ->getSourceProperty('private');

  /** @var \Drupal\Node\NodeTypeInterface $type */
  $type = NodeType::load($node_type);
  $type
    ->setThirdPartySetting('private', 'private', $private);
  $type
    ->save();
  return [
    0 => $node_type,
  ];
}