Ejemplo n.º 1
0
/**
 * Implements hook_wysiwyg_fields_add_js().
 */
function hook_wysiwyg_fields_add_js($type)
{
    switch ($type) {
        case 'node_form':
            foreach (wysiwyg_profile_load_all() as $profile) {
                if (isset($profile->editor) && file_exists($js = drupal_get_path('module', 'MYMODULE') . "/scripts/wysiwyg.{$profile->editor}.js")) {
                    drupal_add_js($js);
                }
            }
            break;
    }
}
Ejemplo n.º 2
0
 /**
  * Overrides Drupal\configuration\Config\Configuration::alterDependencies().
  */
 public static function alterDependencies(Configuration $config)
 {
     if ($config->getComponent() == 'text_format') {
         $formats = filter_formats();
         foreach (array_keys(wysiwyg_profile_load_all()) as $format) {
             // Text format may vanish without deleting the wysiwyg profile.
             if (isset($formats[$format]) && $format == $config->getIdentifier()) {
                 $identifier = $format;
                 $wysiwig_profile = new WysiwygConfiguration($identifier);
                 $wysiwig_profile->build();
                 $config->addToOptionalConfigurations($wysiwig_profile);
                 $wysiwig_profile->addToDependencies($config);
             }
         }
     }
 }