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 261
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 = Editor::loadMultiple();
  return isset($editors[$format_id]) ? $editors[$format_id] : NULL;
}
doc_Drupal
2016-10-29 09:03:57
Comments
Leave a Comment

Please login to continue.