You are here

protected function NoNbspWebTestBase::createTextFormatProgrammatically in No Non-breaking Space Filter 8

Create a new text format.

Create a new text format with an enabled no non-breaking space filter programmatically.

Parameters

string $name: The machine name of the new text format.

bool $status: If the filter is enabled or not.

File

src/Tests/NoNbspWebTestBase.php, line 30
Tests for the no_nbsp.module.

Class

NoNbspWebTestBase
Base class for the no non-breaking space filter tests.

Namespace

Drupal\no_nbsp\Tests

Code

protected function createTextFormatProgrammatically($name, $status) {
  $format = [
    'format' => $name,
    'name' => $name,
    'filters' => [
      'filter_no_nbsp' => [
        'status' => $status,
      ],
    ],
  ];
  $format = (object) $format;
  filter_format_save($format);
  return $format;
}