core/modules/filter/filter.module | 5 ++--- .../filter/lib/Drupal/filter/Tests/FilterFormTest.php | 19 ++++++++++--------- .../Drupal/filter_test/Form/FilterTestFormatForm.php | 2 -- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 8e5ab61..397a8d1 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -444,8 +444,8 @@ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE, * - #format: (optional) The text format ID to preselect. If omitted, the * default format for the current user will be used. * - #allowed_formats: (optional) An array of text format IDs that are - * available for this element. If omitted, all text formats enabled for the - * current user will be allowed. + * available for this element. If omitted, all text formats that the current + * user has access to will be allowed. * * @return * The expanded element. @@ -504,7 +504,6 @@ function filter_process_format($element) { // certain text formats to be used for certain text areas. In case the // fallback format is supposed to be allowed as well, it must be added to // $element['#allowed_formats'] explicitly. - $formats = array_intersect_key($formats, array_flip($element['#allowed_formats'])); } diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormTest.php index 411ec30..e9eca68 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterFormTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterFormTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\filter\Tests\FilterFormTest. + * Contains \Drupal\filter\Tests\FilterFormTest. */ namespace Drupal\filter\Tests; @@ -97,8 +97,8 @@ protected function doFilterFormTestAsAdmin() { // \Drupal\filter_test\Form\FilterTestFormatForm::buildForm() uses // 'filtered_html' as the default value in this case. $this->assertOptions('edit-all-formats-default-format--2', $formats, 'filter_test'); - // If a missing format is given as default, administers must select a valid - // replacement format. + // If a missing format is set as the default, administrators must select a + // valid replacement format. $this->assertRequiredSelect('edit-all-formats-default-missing-format--2', $formats); // Test a text format element with a predefined list of formats. @@ -111,7 +111,7 @@ protected function doFilterFormTestAsAdmin() { // Test a text format element with a fixed format. $formats = array('filter_test'); // When there is only a single option there is no point in choosing. - $this->assertNoSelect('edit-single-format-no-default-format--2');; + $this->assertNoSelect('edit-single-format-no-default-format--2'); $this->assertNoSelect('edit-single-format-default-format--2'); // If the select has a missing or disallowed format make the administrator // explicitly choose the format. @@ -143,8 +143,8 @@ protected function doFilterFormTestAsNonAdmin() { // The user only has access to the 'filter_test' format, so when no default // is given that is preselected and the text format select is hidden. $this->assertNoSelect('edit-restricted-formats-no-default-format--2'); - // When the format that the user does not have access to is preselected the - // textarea is disabled. + // When the format that the user does not have access to is preselected, the + // textarea should be disabled. $this->assertDisabledTextarea('edit-restricted-formats-default-value'); $this->assertDisabledTextarea('edit-restricted-formats-default-missing-value'); $this->assertDisabledTextarea('edit-restricted-formats-default-disallowed-value'); @@ -152,7 +152,7 @@ protected function doFilterFormTestAsNonAdmin() { // Test a text format element with a fixed format. $formats = array('filtered_html'); // When there is only a single option there is no point in choosing. - $this->assertNoSelect('edit-single-format-no-default-format--2');; + $this->assertNoSelect('edit-single-format-no-default-format--2'); $this->assertNoSelect('edit-single-format-default-format--2'); // If the select has a missing or disallowed format make the administrator // explicitly choose the format. @@ -204,8 +204,8 @@ protected function assertOptions($id, array $expected_options, $selected) { } } - // Make sure that all options were found and that there are no additional - // options. + // Make sure that all expected options were found and that there are no + // unexpected options. foreach ($expected_options as $expected_option) { $this->fail(String::format('Option @option for field @id exists.', array( '@option' => $expected_option, @@ -267,4 +267,5 @@ protected function assertDisabledTextarea($id) { $select_id = str_replace('value', 'format--2', $id); $this->assertNoSelect($select_id); } + } diff --git a/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Form/FilterTestFormatForm.php b/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Form/FilterTestFormatForm.php index f01c993..19fe00a 100644 --- a/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Form/FilterTestFormatForm.php +++ b/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Form/FilterTestFormatForm.php @@ -50,7 +50,6 @@ public function buildForm(array $form, array &$form_state) { $form['restricted_formats'] = array( '#type' => 'details', '#title' => 'Restricted text format list', - '#allowed_formats' => array('full_html', 'filter_test'), ); $form['restricted_formats']['no_default'] = array( '#type' => 'text_format', @@ -79,7 +78,6 @@ public function buildForm(array $form, array &$form_state) { $form['single_format'] = array( '#type' => 'details', '#title' => 'Single text format', - '#allowed_formats' => array('filter_test'), ); $form['single_format']['no_default'] = array( '#type' => 'text_format',