W3cubDocs

/Drupal 8

function editor_load

editor_load($format_id)

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.

File

core/modules/editor/editor.module, line 247
Adds bindings for client-side "text editors" to text formats.

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 = entity_load_multiple('editor');
  return isset($editors[$format_id]) ? $editors[$format_id] : NULL;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!editor!editor.module/function/editor_load/8.1.x