• Resolved rbos

    (@mnrtjer)


    With the filter ‘blocks_everywhere_editor_settings’ I’m trying to change the options or remove parts from the editor toolbar. Like the three dots on the right and the arrow down / alignment options.

    But everything what I do with the filter doesn’t return on the front page. I use blocks_everywhere together with bbPress. Also the comment textarea has blocks_everywhere.

    Example of my filter code:

    function blocks_everywhere_editor_settings_custom($settings)
    {
    //var_dump($settings);
    $settings['iso']['blocks']['allowBlocks'][] = ['**/imagecard'];
    $settings['iso']['toolbar']['navigation'] = false;
    $settings['editor']['titlePlaceholder'] = 'test';
    $settings['editor']['disableLayoutStyles'] = false;
    $settings['editor']['richEditingEnabled'] = false;
    return $settings;
    }
    
    add_filter('blocks_everywhere_editor_settings', 'blocks_everywhere_editor_settings_custom', 10, 2);
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author John Godley

    (@johnny5)

    Are you creating this filter early enough that it is used?

    Thread Starter rbos

    (@mnrtjer)

    I have added the filter to the functions.php inside my theme. Also if I place the filter above all my functions or in a clean theme “Twenty Twenty-Three” the filter doesn’t work.

    Plugin Author John Godley

    (@johnny5)

    Ok, I would look in the plugin where blocks_everywhere_editor_settings is used and output some debug there and in your filter. Then you can see if the order is correct.

    Thread Starter rbos

    (@mnrtjer)

    I have a theme that can be debuged with my filter options.

    1. Download the theme: GeneratePress
    2. Edit the functions.php
    3. Add after the wp_enqueue_scripts code my add_filter hook
    4. Then visit a forum and check the message field with the editor options
    5. The message field is the same and nothing has been removed or changed?
    Plugin Author John Godley

    (@johnny5)

    Sorry, I can’t debug your code like that.

    I don’t know what you mean about the message field is the same. You should go through and add as much debugging information as necessary. Check the code is being loaded on that page. Check that it is being executed at the right time (i.e. not before other code might have loaded). Look for errors (PHP and JS). There are many debugging guides on the internet so some of them might help.

    Thread Starter rbos

    (@mnrtjer)

    Hmm I see, but I don’t know how I can explain the situation. The $settings array is getting changed but it doesn’t change the editor bar. Does it needs a higher priority for overruling the standard filter? Or did I misunderstood how the filter works?

    Debuging I’m aware off and there are no errors in the code / log / console etc.

    Plugin Author John Godley

    (@johnny5)

    Do you see your settings if you type wpBlocksEverywhere in a browser console?

    Thread Starter rbos

    (@mnrtjer)

    Yes, my changes are visibile in the object return. Additional information: I’m using blocks-everywhere together with bbPress.

    Plugin Author John Godley

    (@johnny5)

    If I drop your code into the blocks-everywhere.php plugin it runs and works. From your settings the only one that has an effect is the navigation setting. The others either don’t work as you think, are ignored by Gutenberg, or are changed internally within the editor.

    For example, titlePlaceholder is not even used as there is no title.

    Thread Starter rbos

    (@mnrtjer)

    Thanks for the explanation, a custom plugin loads after the theme functions.php might be a loading order issue? I will give it a try in a custom plugin.

    If I want to remove specific parts from the toolbar like the arrow after the link and the three dots with submenu options can I do this with this filter? Or will this be overruled with the Gutenberg standards?

    Plugin Author John Godley

    (@johnny5)

    The vertical ellipsis menu is not enabled by default. The one shown here in the WP support forum is a custom option.

    Do you mean the formatting options? They are not configurable from settings and require you to run your own customisation code to remove Gutenberg formats.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Change the editor options’ is closed to new replies.