6

I am creating a custom component and in my form I am using the editor form field type. Here is the documentation: https://docs.joomla.org/Editor_form_field_type

It seems that no matter what value I set for the editors-xtd 'buttons' attribute, no buttons are shown. There is one exception, if the attribute is set to true, all buttons are shown. In the context of my component, only the article and image buttons are applicable.

The documentation seems to indicate that the 'buttons' attribute should include an array of buttons to be excluded, in this case, pagebreak and readmore. I have tried a number of things, none of which have had the desired result.

How does this actually work? Thank you for your help.

4

Try something like this:

buttons = "true" | Show all buttons. hide = "article,image" | An array of the buttons you want to hide.

<field 
   name="myeditor" 
   label ="label text"
   type="editor"
   editor="jce"
   buttons="true"
   width="450"
   height="280"
   hide="article,image"
   filter="safehtml"
   description="description text" />
  • Thank you FFrewin. Your solution works as expected and resolves my issue. – Zachary Draper Dec 10 '14 at 21:51
5

What should happen is that you pass a string of comma separated values into the form field of the buttons that you do not want to appear. This gets exploded into an array here: https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/form/field/editor.php#L222

In the form field you get a JEditor Instance and in the getButtons method there it will filter out the buttons you list. https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/editor/editor.php#L436 The name of the buttons as you can see from Line 450 should be the name of the plugin

0

In addition to George Wilson's answer:

When instantiating the editor directly in your source code you can provide an array of buttons that should be hidden to the display method of the editor.

Normally, you would enable showing all of the buttons by supplying true to the buttons parameter, like so:

$editor = JEditor::getInstance();
echo $editor->display(
    'my-editor',
    'Default value',
    600,
    100,
    10,
    10,
    true // Show all buttons
);

See https://api.joomla.org/cms-3/classes/JEditor.html#method_display. According to the API the buttons parameter takes a boolean either being true or false. In practise, however, it is possible to supply an array like this:

$editor = JEditor::getInstance();
echo $editor->display(
    'my-editor',
    'Default value',
    600,
    100,
    10,
    10,
    array( 'article', 'pagebreak' ) // List of buttons that should be hidden
);

I believe the full list of button names that you can hide is:

  • article
  • image
  • pagebreak
  • readmore
-1

Go to plugins - your editor . you can set your buttons there. For tinymce - i can found the following settings in the plugin manager enter image description here

  • Thanks for your answer, but unfortunately this does not help. These are not the same buttons, and these settings are site wide. I am attempting to modify the buttons shown only for a specific custom component. – Zachary Draper Dec 10 '14 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.