PrivateContentSettings.php in Private content 8.2
File
src/Plugin/migrate/source/d6/PrivateContentSettings.php
View source
<?php
namespace Drupal\private_content\Plugin\migrate\source\d6;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
class PrivateContentSettings extends DrupalSqlBase {
public function query() {
$query = $this
->select('node_type', 't')
->fields('t', array(
'type',
));
return $query;
}
public function prepareRow(Row $row) {
$node_type = $row
->getSourceProperty('type');
$setting = $this
->variableGet('private_' . $node_type, 1);
$row
->setSourceProperty('private', $setting);
return parent::prepareRow($row);
}
public function fields() {
return array(
'id' => $this
->t('Private content type.'),
);
}
public function getIds() {
$ids['type']['type'] = 'string';
return $ids;
}
}