diff --git a/core/modules/filter/filter.admin.inc b/core/modules/filter/filter.admin.inc index 039ae8d..60eb996 100644 --- a/core/modules/filter/filter.admin.inc +++ b/core/modules/filter/filter.admin.inc @@ -342,7 +342,6 @@ function filter_admin_format_form_validate($form, &$form_state) { form_set_value($form['format'], $format_format, $form_state); form_set_value($form['name'], $format_name, $form_state); - $result = filter_format_load($format_name); $filter_formats = entity_load_multiple('filter_format'); foreach ($filter_formats as $format) { if ($format->name == $format_name && $format->format != $format_format) { diff --git a/core/modules/filter/filter.install b/core/modules/filter/filter.install index 7a125f8..76ddc00 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -5,8 +5,6 @@ * Install, update, and uninstall functions for the Filter module. */ -use Drupal\Core\Config\Filter\FilterFormat; - /** * Implements hook_schema(). */ @@ -26,34 +24,11 @@ function filter_install() { // users have access to, so add it here. We initialize it as a simple, safe // plain text format with very basic formatting, but it can be modified by // installation profiles to have other properties. - $plain_text_format = array( - 'format' => 'plain_text', - 'name' => 'Plain text', - 'weight' => 10, - 'filters' => array( - // Escape all HTML. - 'filter_html_escape' => array( - 'weight' => 0, - 'status' => 1, - ), - // URL filter. - 'filter_url' => array( - 'weight' => 1, - 'status' => 1, - ), - // Line break filter. - 'filter_autop' => array( - 'weight' => 2, - 'status' => 1, - ), - ), - ); - - $format = entity_create('filter_format', $plain_text_format); - filter_format_save($format); + // + // See core/modules/filter/config/filter.format.plain_text.yml. // Set the fallback format to plain text. - variable_set('filter_fallback_format', $format->format); + variable_set('filter_fallback_format', 'plain_text'); } /** diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index e6d0a10..5c20f11 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -739,7 +739,7 @@ function _filter_list_cmp($a, $b) { /** * Sorts an array of filters by filter weight, module, name. * - * Callback for uasort() within filter_formats(). + * Callback for uasort() within filter_list_format(). */ function _filter_format_filter_cmp($a, $b) { if ($a->weight != $b->weight) { diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index b795ef7..243b47e 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -12,62 +12,6 @@ * @see system_install() */ function standard_install() { - // Add text formats. - $filtered_html_format_config = array( - 'format' => 'filtered_html', - 'name' => 'Filtered HTML', - 'weight' => 0, - 'filters' => array( - // URL filter. - 'filter_url' => array( - 'weight' => 0, - 'status' => 1, - ), - // HTML filter. - 'filter_html' => array( - 'weight' => 1, - 'status' => 1, - ), - // Line break filter. - 'filter_autop' => array( - 'weight' => 2, - 'status' => 1, - ), - // HTML corrector filter. - 'filter_htmlcorrector' => array( - 'weight' => 10, - 'status' => 1, - ), - ), - ); - $filtered_html_format = entity_create('filter_format', $filtered_html_format_config); - filter_format_save($filtered_html_format); - - $full_html_format_config = array( - 'format' => 'full_html', - 'name' => 'Full HTML', - 'weight' => 1, - 'filters' => array( - // URL filter. - 'filter_url' => array( - 'weight' => 0, - 'status' => 1, - ), - // Line break filter. - 'filter_autop' => array( - 'weight' => 1, - 'status' => 1, - ), - // HTML corrector filter. - 'filter_htmlcorrector' => array( - 'weight' => 10, - 'status' => 1, - ), - ), - ); - $full_html_format = entity_create('filter_format', $full_html_format_config); - filter_format_save($full_html_format); - // Enable Bartik theme and set it as default theme instead of Stark. // @see system_install() $default_theme = 'bartik'; @@ -374,6 +318,7 @@ function standard_install() { field_create_instance($instance); // Enable default permissions for system roles. + $filtered_html_format->format = 'filtered_html'; $filtered_html_permission = filter_permission_name($filtered_html_format); user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', $filtered_html_permission)); user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_permission)); diff --git a/core/modules/filter/config/filter.format.plain_text.yml b/core/modules/filter/config/filter.format.plain_text.yml new file mode 100644 index 0000000..ceff5d2 --- /dev/null +++ b/core/modules/filter/config/filter.format.plain_text.yml @@ -0,0 +1,13 @@ +format: plain_text +name: Plain text +weight: 10 +filters: + filter_html_escape: + weight: 0 + status: 1 + filter_url: + weight: 1 + status: 1 + filter_autop: + weight: 2 + status: 1 diff --git a/core/profiles/standard/config/filter.format.filtered_html.yml b/core/profiles/standard/config/filter.format.filtered_html.yml new file mode 100644 index 0000000..1b905c6 --- /dev/null +++ b/core/profiles/standard/config/filter.format.filtered_html.yml @@ -0,0 +1,16 @@ +format: filtered_html +name: Filtered HTML +weight: 0 +filters: + filter_url: + weight: 0 + status: 1 + filter_html: + weight: 1 + status: 1 + filter_autop: + weight: 2 + status: 1 + filter_htmlcorrector: + weight: 10 + status: 1 diff --git a/core/profiles/standard/config/filter.format.full_html.yml b/core/profiles/standard/config/filter.format.full_html.yml new file mode 100644 index 0000000..bc01d83 --- /dev/null +++ b/core/profiles/standard/config/filter.format.full_html.yml @@ -0,0 +1,13 @@ +format: full_html +name: Full HTML +weight: 1 +filters: + filter_url: + weight: 0 + status: 1 + filter_autop: + weight: 1 + status: 1 + filter_htmlcorrector: + weight: 10 + status: 1