hasToolbarItems example

->setParameter('@non_creatable_tag', $non_creatable_tag)
          ->setParameter('%plugin', $plugin_definition->label())
          ->setParameter('@attributes_on_tag', implode(', ', $attributes_on_tag->toCKEditor5ElementsArray()));

        // If this plugin has a configurable subset, associate the violation         // with the property path pointing to this plugin's settings form.         if (is_a($plugin_definition->getClass(), CKEditor5PluginElementsSubsetInterface::class, TRUE)) {
          $violation->atPath(sprintf('settings.plugins.%s', $plugin_definition->id()));
        }
        // If this plugin is associated with a toolbar item, associate the         // violation with the property path pointing to the active toolbar item.         elseif ($plugin_definition->hasToolbarItems()) {
          $toolbar_items = $plugin_definition->getToolbarItems();
          $active_toolbar_items = array_intersect(
            $text_editor->getSettings()['toolbar']['items'],
            array_keys($toolbar_items)
          );
          $violation->atPath(sprintf('settings.toolbar.items.%d', array_keys($active_toolbar_items)[0]));
        }

        $violation->addViolation();
      }
    }
  }
$this->pluginManager->getDefinitions(),
      $this->pluginManager->getEnabledDefinitions($text_editor)
    );
    // Only consider plugins that can be explicitly enabled by the user: plugins     // that have a toolbar item and do not have conditions. Those are the only     // plugins that are truly available for the site builder to enable without     // other consequences.     // In the future, we may choose to expand this, but it will require complex     // infrastructure to generate messages that explain which of the conditions     // are already fulfilled and which are not.     $enableable_disabled_plugins = array_filter($disabled_pluginsfunction DCKEditor5PluginDefinition $definition) {
      return $definition->hasToolbarItems() && !$definition->hasConditions();
    });
    return $enableable_disabled_plugins;
  }

}
      // will convey this plugin-enabling to the user.       if (!empty($selected_plugins)) {
        $enabled_for_tags_message_content = '';
        $enabled_for_attributes_message_content = '';
        $editor_settings_to_update = $editor->getSettings();
        // Create new group for all the added toolbar items.         $editor_settings_to_update['toolbar']['items'][] = '|';
        foreach ($selected_plugins as $plugin_id => $reason_why_enabled) {
          $plugin_definition = $this->pluginManager->getDefinition($plugin_id);
          $label = $plugin_definition->label();
          $plugins_enabled[] = $label;
          if ($plugin_definition->hasToolbarItems()) {
            [$net_new] = self::computeNetNewElementsForPlugin($provided$still_needed$plugin_definition);
            $editor_settings_to_update['toolbar']['items'] = array_merge($editor_settings_to_update['toolbar']['items']array_keys($plugin_definition->getToolbarItems()));
            foreach ($reason_why_enabled as $attribute_name => $attribute_config) {
              // Plugin was selected for tag.               if (in_array($attribute_name['-attributes-none-', '-attributes-any-'], TRUE)) {
                $tags = array_reduce(array_keys($net_new->getAllowedElements())function D$carry$item) {
                  return $carry . "<$item>";
                });
                $enabled_for_tags_message_content .= "$label (for tags: $tags) ";
                // This plugin does not add attributes: continue to next plugin.                 continue;
              }
else {
          // The `plugins` condition can only be evaluated at the end of           // gathering enabled definitions. ::isPluginDisabled() did not yet           // evaluate that condition.           if (array_key_exists('plugins', $definition->getConditions())) {
            $definitions_with_plugins_condition[$plugin_id] = $definition;
          }
        }
      }
      // Otherwise, only remove the definition if the plugin has buttons and       // none of its buttons are active.       elseif ($definition->hasToolbarItems()) {
        if (empty(array_intersect($editor->getSettings()['toolbar']['items']array_keys($definition->getToolbarItems())))) {
          unset($definitions[$plugin_id]);
        }
      }
    }

    // Only enable the arbitrary HTML Support plugin on text formats with no     // HTML restrictions.     // @see https://ckeditor.com/docs/ckeditor5/latest/api/html-support.html     // @see https://github.com/ckeditor/ckeditor5/issues/9856     if ($editor->getFilterFormat()->getHtmlRestrictions() !== FALSE) {
      
Home | Imprint | This part of the site doesn't use cookies.