function editor_load

Same name in other branches
  1. 9 core/modules/editor/editor.module \editor_load()
  2. 8.9.x core/modules/editor/editor.module \editor_load()
  3. 10 core/modules/editor/editor.module \editor_load()

Loads an individual configured text editor based on text format ID.

Parameters

int $format_id: A text format ID.

Return value

\Drupal\editor\Entity\Editor|null A text editor object, or NULL.

6 calls to editor_load()
EditorAdminTest::verifyUnicornEditorConfiguration in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Verifies unicorn editor configuration.
EditorManager::getAttachments in core/modules/editor/src/Plugin/EditorManager.php
Retrieves text editor libraries and JavaScript settings.
editor_filter_xss in core/modules/editor/editor.module
Applies text editor XSS filtering.
editor_form_filter_admin_format_submit in core/modules/editor/editor.module
Additional submit handler for filter_format_form().
editor_form_filter_admin_overview_alter in core/modules/editor/editor.module
Implements hook_form_FORM_ID_alter().

... See full list

File

core/modules/editor/editor.module, line 275

Code

function editor_load($format_id) {
    // Load all the editors at once here, assuming that either no editors or more
    // than one editor will be needed on a page (such as having multiple text
    // formats for administrators). Loading a small number of editors all at once
    // is more efficient than loading multiple editors individually.
    $editors = Editor::loadMultiple();
    return $editors[$format_id] ?? NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.