diff --git a/core/modules/editor/src/Form/EditorImageDialog.php b/core/modules/editor/src/Form/EditorImageDialog.php
index 34eed26..5f9e831 100644
--- a/core/modules/editor/src/Form/EditorImageDialog.php
+++ b/core/modules/editor/src/Form/EditorImageDialog.php
@@ -48,7 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
$form['#prefix'] = '
';
$form['#suffix'] = '
';
- $editor = editor_load($filter_format->format);
+ $editor = editor_load($filter_format->id());
// Construct strings to use in the upload validators.
$image_upload = $editor->getImageUploadSettings();
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index cad200c..cb046b4 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -155,7 +155,7 @@ function filter_formats(AccountInterface $account = NULL) {
$formats['user'][$account_id] = array();
foreach ($formats['all'] as $format) {
if ($format->access('use', $account)) {
- $formats['user'][$account_id][$format->format] = $format;
+ $formats['user'][$account_id][$format->id()] = $format;
}
}
}
@@ -245,7 +245,7 @@ function filter_default_format(AccountInterface $account = NULL) {
// available is the user's default format.
$formats = filter_formats($account);
$format = reset($formats);
- return $format->format;
+ return $format->id();
}
/**
@@ -407,7 +407,7 @@ function template_preprocess_filter_guidelines(&$variables) {
$format = $variables['format'];
$variables['tips'] = array(
'#theme' => 'filter_tips',
- '#tips' => _filter_tips($format->format, FALSE),
+ '#tips' => _filter_tips($format->id(), FALSE),
);
}
diff --git a/core/modules/filter/src/Entity/FilterFormat.php b/core/modules/filter/src/Entity/FilterFormat.php
index 1f38428..dd33865 100644
--- a/core/modules/filter/src/Entity/FilterFormat.php
+++ b/core/modules/filter/src/Entity/FilterFormat.php
@@ -52,7 +52,7 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En
*
* @var string
*/
- public $format;
+ public $id;
/**
* Unique label of the text format.
@@ -61,11 +61,9 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En
* label but different filter configuration would impose a security risk.
* Therefore, each text format label must be unique.
*
- * @todo Rename to $label.
- *
* @var string
*/
- public $name;
+ public $label;
/**
* Weight of this format in the text format selector.
@@ -122,7 +120,7 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En
* {@inheritdoc}
*/
public function id() {
- return $this->format;
+ return $this->id;
}
/**
@@ -192,7 +190,7 @@ public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
- $this->name = trim($this->label());
+ $this->label = trim($this->label());
}
/**
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index de3ab11..6d1bf09 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -243,13 +243,13 @@ function testFilterAdmin() {
filter_formats_reset();
$format = entity_load('filter_format', $edit['format']);
$this->assertNotNull($format, 'Format found in database.');
- $this->drupalGet('admin/config/content/formats/manage/' . $format->format);
+ $this->drupalGet('admin/config/content/formats/manage/' . $format->id());
$this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', '', 'Role found.');
$this->assertFieldByName('filters[' . $second_filter . '][status]', '', 'Line break filter found.');
$this->assertFieldByName('filters[' . $first_filter . '][status]', '', 'Url filter found.');
// Disable new filter.
- $this->drupalPostForm('admin/config/content/formats/manage/' . $format->format . '/disable', array(), t('Disable'));
+ $this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', array(), t('Disable'));
$this->assertUrl('admin/config/content/formats');
$this->assertRaw(t('Disabled text format %format.', array('%format' => $edit['name'])), 'Format successfully disabled.');
@@ -260,7 +260,7 @@ function testFilterAdmin() {
$edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1;
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats');
- $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), 'Full HTML format successfully updated.');
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->label())), 'Full HTML format successfully updated.');
// Switch user.
$this->drupalLogin($this->web_user);
@@ -318,7 +318,7 @@ function testFilterAdmin() {
$edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = FALSE;
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats');
- $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), 'Full HTML format successfully reverted.');
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->label())), 'Full HTML format successfully reverted.');
$this->drupalGet('admin/config/content/formats/manage/' . $full);
$this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'], 'Changes reverted.');
diff --git a/core/modules/filter/src/Tests/FilterCrudTest.php b/core/modules/filter/src/Tests/FilterCrudTest.php
index 75bf568..b1c41b5 100644
--- a/core/modules/filter/src/Tests/FilterCrudTest.php
+++ b/core/modules/filter/src/Tests/FilterCrudTest.php
@@ -70,20 +70,20 @@ function testTextFormatCrud() {
$format->disable()->save();
$formats = filter_formats();
- $this->assertTrue(!isset($formats[$format->format]), 'filter_formats: Disabled text format no longer exists.');
+ $this->assertTrue(!isset($formats[$format->id()]), 'filter_formats: Disabled text format no longer exists.');
}
/**
* Verifies that a text format is properly stored.
*/
function verifyTextFormat($format) {
- $t_args = array('%format' => $format->name);
+ $t_args = array('%format' => $format->label());
$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->id;
// Verify the loaded filter has all properties.
- $filter_format = entity_load('filter_format', $format->format);
- $this->assertEqual($filter_format->format, $format->format, format_string('filter_format_load: Proper format id for text format %format.', $t_args));
- $this->assertEqual($filter_format->name, $format->name, format_string('filter_format_load: Proper title for text format %format.', $t_args));
+ $filter_format = entity_load('filter_format', $format->id());
+ $this->assertEqual($filter_format->format, $format->id(), format_string('filter_format_load: Proper format id for text format %format.', $t_args));
+ $this->assertEqual($filter_format->label(), $format->label(), format_string('filter_format_load: Proper title for text format %format.', $t_args));
$this->assertEqual($filter_format->weight, $format->weight, format_string('filter_format_load: Proper weight for text format %format.', $t_args));
// Check that the filter was created in site default language.
$this->assertEqual($format->language()->getId(), $default_langcode, format_string('filter_format_load: Proper language code for text format %format.', $t_args));