function FilterFormat::prepareRow
Same name in this branch
- 11.x core/modules/filter/src/Plugin/migrate/source/d7/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d7\FilterFormat::prepareRow()
Same name in other branches
- 9 core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d6\FilterFormat::prepareRow()
- 9 core/modules/filter/src/Plugin/migrate/source/d7/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d7\FilterFormat::prepareRow()
- 8.9.x core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d6\FilterFormat::prepareRow()
- 8.9.x core/modules/filter/src/Plugin/migrate/source/d7/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d7\FilterFormat::prepareRow()
- 10 core/modules/filter/src/Plugin/migrate/source/d6/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d6\FilterFormat::prepareRow()
- 10 core/modules/filter/src/Plugin/migrate/source/d7/FilterFormat.php \Drupal\filter\Plugin\migrate\source\d7\FilterFormat::prepareRow()
Overrides SourcePluginBase::prepareRow
File
-
core/
modules/ filter/ src/ Plugin/ migrate/ source/ d6/ FilterFormat.php, line 46
Class
- FilterFormat
- Drupal 6 filter source from database.
Namespace
Drupal\filter\Plugin\migrate\source\d6Code
public function prepareRow(Row $row) {
$filters = [];
$roles = $row->getSourceProperty('roles');
$row->setSourceProperty('roles', array_values(array_filter(explode(',', $roles))));
$format = $row->getSourceProperty('format');
// Find filters for this row.
$results = $this->select('filters', 'f')
->fields('f', [
'module',
'delta',
'weight',
])
->condition('format', $format)
->execute();
foreach ($results as $raw_filter) {
$module = $raw_filter['module'];
$delta = $raw_filter['delta'];
$filter = [
'module' => $module,
'delta' => $delta,
'weight' => $raw_filter['weight'],
'settings' => [],
];
// Load the filter settings for the filter module, modules can use
// hook_migration_d6_filter_formats_prepare_row() to add theirs.
if ($raw_filter['module'] == 'filter') {
if (!$delta) {
if ($setting = $this->variableGet("allowed_html_{$format}", NULL)) {
$filter['settings']['allowed_html'] = $setting;
}
if ($setting = $this->variableGet("filter_html_help_{$format}", NULL)) {
$filter['settings']['filter_html_help'] = $setting;
}
if ($setting = $this->variableGet("filter_html_nofollow_{$format}", NULL)) {
$filter['settings']['filter_html_nofollow'] = $setting;
}
}
elseif ($delta == 2 && ($setting = $this->variableGet("filter_url_length_{$format}", NULL))) {
$filter['settings']['filter_url_length'] = $setting;
}
}
$filters[] = $filter;
}
$row->setSourceProperty('filters', $filters);
return parent::prepareRow($row);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.