GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/editor/src/Plugin/ |
Upload File : |
<?php namespace Drupal\editor\Plugin; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; /** * Configurable text editor manager. * * @see \Drupal\editor\Annotation\Editor * @see \Drupal\editor\Plugin\EditorPluginInterface * @see \Drupal\editor\Plugin\EditorBase * @see plugin_api */ class EditorManager extends DefaultPluginManager { /** * Constructs an EditorManager object. * * @param \Traversable $namespaces * An object that implements \Traversable which contains the root paths * keyed by the corresponding namespace to look for plugin implementations. * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend * Cache backend instance to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler to invoke the alter hook with. */ public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { parent::__construct('Plugin/Editor', $namespaces, $module_handler, 'Drupal\editor\Plugin\EditorPluginInterface', 'Drupal\editor\Annotation\Editor'); $this->alterInfo('editor_info'); $this->setCacheBackend($cache_backend, 'editor_plugins'); } /** * Populates a key-value pair of available text editors. * * @return array * An array of translated text editor labels, keyed by ID. */ public function listOptions() { $options = []; foreach ($this->getDefinitions() as $key => $definition) { $options[$key] = $definition['label']; } return $options; } /** * Retrieves text editor libraries and JavaScript settings. * * @param array $format_ids * An array of format IDs as returned by array_keys(filter_formats()). * * @return array * An array of attachments, for use with #attached. * * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments() */ public function getAttachments(array $format_ids) { $attachments = ['library' => []]; $settings = []; foreach ($format_ids as $format_id) { $editor = editor_load($format_id); if (!$editor) { continue; } $plugin = $this->createInstance($editor->getEditor()); $plugin_definition = $plugin->getPluginDefinition(); // Libraries. $attachments['library'] = array_merge($attachments['library'], $plugin->getLibraries($editor)); // Format-specific JavaScript settings. $settings['editor']['formats'][$format_id] = [ 'format' => $format_id, 'editor' => $editor->getEditor(), 'editorSettings' => $plugin->getJSSettings($editor), 'editorSupportsContentFiltering' => $plugin_definition['supports_content_filtering'], 'isXssSafe' => $plugin_definition['is_xss_safe'], ]; } // Allow other modules to alter all JavaScript settings. $this->moduleHandler->alter('editor_js_settings', $settings); if (empty($attachments['library']) && empty($settings)) { return []; } $attachments['drupalSettings'] = $settings; return $attachments; } }