function NodeType::prepareRow

Same name in this branch
  1. 11.x core/modules/node/src/Plugin/migrate/source/d7/NodeType.php \Drupal\node\Plugin\migrate\source\d7\NodeType::prepareRow()
Same name in other branches
  1. 9 core/modules/node/src/Plugin/migrate/source/d6/NodeType.php \Drupal\node\Plugin\migrate\source\d6\NodeType::prepareRow()
  2. 9 core/modules/node/src/Plugin/migrate/source/d7/NodeType.php \Drupal\node\Plugin\migrate\source\d7\NodeType::prepareRow()
  3. 8.9.x core/modules/node/src/Plugin/migrate/source/d6/NodeType.php \Drupal\node\Plugin\migrate\source\d6\NodeType::prepareRow()
  4. 8.9.x core/modules/node/src/Plugin/migrate/source/d7/NodeType.php \Drupal\node\Plugin\migrate\source\d7\NodeType::prepareRow()
  5. 10 core/modules/node/src/Plugin/migrate/source/d6/NodeType.php \Drupal\node\Plugin\migrate\source\d6\NodeType::prepareRow()
  6. 10 core/modules/node/src/Plugin/migrate/source/d7/NodeType.php \Drupal\node\Plugin\migrate\source\d7\NodeType::prepareRow()

Overrides SourcePluginBase::prepareRow

File

core/modules/node/src/Plugin/migrate/source/d6/NodeType.php, line 124

Class

NodeType
Drupal 6 Node types source from database.

Namespace

Drupal\node\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {
    $row->setSourceProperty('teaser_length', $this->teaserLength);
    $row->setSourceProperty('node_preview', $this->nodePreview);
    $type = $row->getSourceProperty('type');
    $source_options = $this->variableGet('node_options_' . $type, [
        'promote',
        'sticky',
    ]);
    $options = [];
    foreach ([
        'promote',
        'sticky',
        'status',
        'revision',
    ] as $item) {
        $options[$item] = in_array($item, $source_options);
    }
    $row->setSourceProperty('options', $options);
    $submitted = $this->themeSettings['toggle_node_info_' . $type] ?? FALSE;
    $row->setSourceProperty('display_submitted', $submitted);
    if ($default_node_menu = $this->variableGet('menu_default_node_menu', NULL)) {
        $row->setSourceProperty('available_menus', [
            $default_node_menu,
        ]);
        $row->setSourceProperty('parent', $default_node_menu . ':');
    }
    if ($this->moduleExists('comment')) {
        foreach (array_keys($this->getCommentFields()) as $field) {
            $row->setSourceProperty($field, $this->variableGet($field . '_' . $type, NULL));
        }
    }
    return parent::prepareRow($row);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.