* Adds bindings for client-side "text editors" to text formats.
*/
use Drupal\file\Plugin\Core\Entity\File;
use Drupal\editor\Plugin\Core\Entity\Editor;
use Drupal\Component\Utility\NestedArray;
/**
* Implements hook_help().
*/
function editor_help($path, $arg) {
switch ($path) {
case 'admin/help#editor':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Text Editor module provides a framework to extend the user interface on text fields that allow HTML input. Without Text Editor module, fields accept only text where formatting must be typed manually, such as entering a <code><strong></code> tag to make text bold or an <code><em></code> tag to italicize text. The Text Editor module allows these fields to be enhanced with rich text editors (WYSIWYGs) or toolbars, which make entering and formatting content easier. For more information, see the online handbook entry for <a href="@editor">Editor module</a>.', array('@editor' => 'http://drupal.org/documentation/modules/editor/')) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Enabling or configuring a text editor') . '</dt>';
$output .= '<dd>' . t('The Text Editor module does not have its own configuration page. Instead it enhances existing configuration pages with additional options. Text editors are attached to individual text formats, which can be configured on the <a href="@formats">Text formats page</a>. Each text format may be associated with a single text editor. When entering content with that text format, the associated text editor will automatically be enabled.', array('@formats' => url('admin/config/content/formats'))) . '</dd>';
$output .= '<dt>' . t('Allowing a user to choose a text editor') . '</dt>';
$output .= '<dd>' . t('Because text editor configurations are bound to a text format, users with access to more than one text format may switch between available text editors by changing the text format for a field. For more information about text formats, see the <a href="@filter">Filter module help page</a>, which describes text formats in more detail.', array('@filter' => url('admin/help/filter'))) . '</dd>';
// @todo: Mention the availability of the built-in core WYSIWYG (CKEditor)
// when it becomes available. See http://drupal.org/node/1878344.
$output .= '<dd>' . t('The Text Editor module does not provide any text editor libraries itself. Most installations of Drupal include a module that provides a text editor library which may be enabled on the <a href="@modules">Modules page</a>. Additional modules that provide text editor libraries may be <a href="@download">downloaded from Drupal.org</a>.', array('@modules' => url('admin/modules'), '@download' => 'http://drupal.org/search/site/wysiwyg%20module')) . '</dd>';
$output .= '</dl>';
return $output;
}
}
/**
* Implements hook_menu_alter().
*
* Rewrites the menu entries for filter module that relate to the configuration
* of text editors.
*/
function editor_menu_alter(&$items) {
$items['admin/config/content/formats']['title'] = 'Text formats and editors';
$items['admin/config/content/formats']['description'] = 'Configure how user-contributed content is filtered and formatted, as well as the text editor user interface (WYSIWYGs or toolbars).';
}
/**
* Implements hook_element_info().
*
* Extends the functionality of text_format elements (provided by Filter
* module), so that selecting a text format notifies a client-side text editor