public function FilterSettings::transform in Drupal 8
Same name and namespace in other branches
- 9 core/modules/filter/src/Plugin/migrate/process/FilterSettings.php \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()
Performs the associated process.
Parameters
mixed $value: The value to be transformed.
\Drupal\migrate\MigrateExecutableInterface $migrate_executable: The migration in which this process is being executed.
\Drupal\migrate\Row $row: The row from the source to process. Normally, just transforming the value is adequate but very rarely you might need to change two columns at the same time or something like that.
string $destination_property: The destination property currently worked on. This is only used together with the $row above.
Return value
string|array The newly transformed value.
Overrides ProcessPluginBase::transform
File
- core/
modules/ filter/ src/ Plugin/ migrate/ process/ FilterSettings.php, line 42
Class
- FilterSettings
- Adds the default allowed attributes to filter_html's allowed_html setting.
Namespace
Drupal\filter\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
// Only the filter_html filter's settings have a changed format.
if ($row
->getDestinationProperty('id') === 'filter_html') {
if (!empty($value['allowed_html'])) {
$value['allowed_html'] = str_replace(array_keys($this->allowedHtmlDefaultAttributes), array_values($this->allowedHtmlDefaultAttributes), $value['allowed_html']);
}
}
elseif ($row
->getDestinationProperty('id') === 'filter_null') {
$value = [];
}
return $value;
}