By tim.plunkett on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
When text formats were converted to configurable entities and filters were converted to plugins, many procedural wrappers were left in place.
The following functions have been removed:
filter_format_load()
filter_format_exists()
filter_permission_name()
filter_list_format()
filter_access()
Loading a text format
Drupal 7
$restricted_html_format = filter_format_load('restricted_html');
Drupal 8
use Drupal\filter\Entity\FilterFormat;
$restricted_html_format = FilterFormat::load('restricted_html');
Checking for an existing text format
Drupal 7
if (filter_format_exists('restricted_html')) {
}
Drupal 8
if ( FilterFormat::load('restricted_html')) {
}
Finding the permission name for a text format
Drupal 7
$permission_name = filter_permission_name($restricted_html_format);
Drupal 8
$permission_name = $restricted_html_format->getPermissionName();
Retrieve the filters for a text format
Drupal 7
$filters = filter_list_format($restricted_html_format->format);
Drupal 8
$filters = $restricted_html_format->filters();
Checking access for a text format
Drupal 7
if (filter_access($restricted_html_format)) {
}
if (filter_access($restricted_html_format, $account)) {
}
Drupal 8
if ($restricted_html_format->access('view')) {
}
if ($restricted_html_format->access('view', $account)) {
}
Impacts:
Module developers