function FilterSettings::transform

Same name and namespace in other branches
  1. 9 core/modules/filter/src/Plugin/migrate/process/FilterSettings.php \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()
  2. 8.9.x core/modules/filter/src/Plugin/migrate/process/FilterSettings.php \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()
  3. 10 core/modules/filter/src/Plugin/migrate/process/FilterSettings.php \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()

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\process

Code

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;
}

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