You are here

ckeditor_bidi.module in CKEditor BiDi Buttons 8

Same filename and directory in other branches
  1. 8.2 ckeditor_bidi.module
  2. 3.x ckeditor_bidi.module

File

ckeditor_bidi.module
View source
<?php

/**
 * @file
 * Contains ckeditor_bidi.module.
 */
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function ckeditor_bidi_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.ckeditor_bidi':
      $output = '';
      $output .= '<h3>' . t('<strong>Configure/Activare</strong>: Go to admin section of your Drupal site /admin/config/content/formats  select text format to configure and activate BiDi buttons by dragging them into active buttons area of the editor toolbar.About CKEditor BiDi Buttons') . '</h3>';
      $output .= '<p>' . t('This module integrates the <a href=":cke_bidi_url">CKEditor BiDi plugin</a> with CKEditor for Drupal 8.  This plugin provides the  bi directional text flow buttons,  RTL and LTR .', array(
        ':cke_bidi_url' => 'http://ckeditor.com/addon/bidi',
      )) . '</p>';
      $output .= '<p>' . t('The buttons provided by CKEditor BiDi plugin makes it possible to change the text direction for an HTML block-level content element like paragraph and list. If you ever created content in languages that are written Right to Left you are probably aware of the need to switch text flow direction.') . '</p>';
      $output .= '<h3>' . t('Configure/Activare') . '</h3>';
      $output .= '<p>' . t('Go to <a href=":formats">Text formats and editors</a> and click the "Configure" button of a text format that already have "CKEditor" selected as "Text Editor".', array(
        ':formats' => \Drupal::url('filter.admin_overview'),
      )) . '</p>';
      $output .= '<p>' . t('Now, while on configuration page of chosen text format, look at the "Toolbar configuration" field/section, and you should be able to see 2 BiDi buttons ready to be dragged and dropped into your preffered section of the CKEditor buttons toolbar.') . '</p>';
      return $output;
  }
}

/**
 * Implements hook_library_info_alter().
 */
function ckeditor_bidi_library_info_alter(&$libraries, $extension) {

  // Add support for "Libraries API" module, if exists.
  if ($extension == 'bidi' && \Drupal::moduleHandler()
    ->moduleExists('libraries')) {
    $libraries['bidi']['js'] = [
      '/' . libraries_get_path('bidi') . '/plugin.js' => [],
    ];
  }
}