Support » Plugin: Kadence Blocks – Gutenberg Page Builder Toolkit » Possible to edit Kadence blocks interface?

  • Resolved immersusmedia

    (@immersusmedia)


    We’d like to customize some elements of the Kadence Gutenberg Blocks plugin and have the following questions:
    1. Can we edit, remove, or create our own prebuilt library items?
    2. Can we disable or control the settings for the blocks in anyway? For example, on the Kadence tabs block a user can edit the tab colors but this is something we’d likely want disabled for our clients so they don’t inadvertently change colors beyond what has been approved for the site. Is this degree of control possible with Kadence gutenberg blocks?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Ben Ritner – Kadence WP

    (@britner)

    Hey,
    1. Yes, no interface for it yet, but through a javascript filter, you can add your own and remove all of the ones there. The basics of a prebuilt layout item is the JSON output of a reusable block.
    The JS filter is kadence.prebuilt_array.

    2. I’m working on some ideas for how to disable certain controls. I’m hoping to add this on a user role basis so you can turn settings off for editors different from admin. But I also plan to make that filterable so any setting could be off for everyone.

    Ben

    immersusmedia

    (@immersusmedia)

    Thanks for the quick reply, Ben!

    For item 2, it definitely would be nice to have it be based on user role. Any idea when something like this might make its way into the plugin? Just want to gauge general timing so we can push forward with using the plugin or not on a project (or at least decide if it is a make or break issue for us). I’m sure you can’t be super specific on timing but even something general would help.

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    I would like to think something like 2-3 weeks.

    Ben

    andrewtoohill

    (@andrewtoohill)

    Hey Ben, great plugin! You mentioned a javascript filter for removing the prebuilt library items and adding our own. Do you have any sample code or more details you can share on how we could go about doing that?

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    const {
    	addFilter,
    } = wp.hooks;
    const { __ } = wp.i18n;
    function example_add_to_prebuilt( options ) {
    	const blockOptions = [
    		{
    			key: 'example_prebuilt_key',
    			content: "USE OUT PUT OF RESUABLE BLOCK JSON HERE", 
    			name: __( 'Example Prebuilt' ),
    			background: 'light',
                            keywords: [ __( 'header' ), __( 'images' ) ],
    			category: [ 'header', 'call-to-action' ],
    			image: 'URL TO IMAGE HERE',
    		},
    	];
    	const newOptions = options.concat( blockOptions );
    	return newOptions;
    }
    addFilter( 'kadence.prebuilt_array', 'example/prebuilt', example_add_to_prebuilt );

    That is the basic JS file, you would enqueue with ‘enqueue_block_editor_assets’.

    andrewtoohill

    (@andrewtoohill)

    Thanks Ben, that worked great. How do I go about also removing all the prebuilt items that are in there? Right now both the pre-existing library items and the new ones I added show up, but ideally we’d only have the ones we need for our project to be there. Appreciate your help.

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    if you change this:

    const newOptions = options.concat( blockOptions );
    	return newOptions;

    To this:

    return blockOptions;

    Then only your array will be shown.

    Ben

    andrewtoohill

    (@andrewtoohill)

    Perfect, thanks Ben!

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    @immersusmedia just wanted to update here, you can now turn off settings for users for that tabs block. More blocks will be added in the coming days but I would love your feedback as to if this was what you were hoping for.

    https://www.kadenceblocks.com/tab-settings-visiblity/

    Ben

    immersusmedia

    (@immersusmedia)

    @britner Ben, this looks great! Couple of things we noticed:

    1. On tabs, even if all the settings are turned off, Tab Title Settings still appears in the controls though it is empty (just the label appears).
    2. On Spacer/Divider, the Gutenberg preview stopped working altogether after updating to Kadence Block 1.3.2 (from 1.3.0). When the Spacer/Divider is added when editing a page, it shows “This block has encountered an error and cannot be previewed” and the controls do not show up at all for the block.

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    Hey,
    1. Yeah I am going to move all the controls out of the inner pane and so that won’t be an issue after the next update.

    2. This is odd. I can’t recreate, which version of gutenberg/wordpress are you using. Have you made default settings? Or set visibility?

    Ben

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    2. Nevermind, I see the issue.

    Plugin Author Ben Ritner – Kadence WP

    (@britner)

    I’ve updated with a fix.

    Ben

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Possible to edit Kadence blocks interface?’ is closed to new replies.