acf-flexible-content-blocks
acf-flexible-content-blocks copied to clipboard
Best way to connect with you?
Hey - sorry for using issues to reach out to you, but I'm hoping to chat about our team contributing to this project, and wanted to pass along some ideas to make sure they were things you'd be interested in having. -Rich
@secretstache I'm happy to discuss features and here's as good a place as any. What do you want to talk about?
thanks @MWDelaney.
- I see that you can filter out default content blocks, but I didn't see how you planned on allowing other plugins or the theme to filter in content blocks. But I did notice that you're latest version has less default blocks, so maybe it's there and I'm not seeing it.
- I would also want the ability to filter 'Hide on Screen.' We almost always remove the main visual editor and use Flex Content as the entire layout builder.
- With regard to #2 , this plugin has a feature where if you select a visual editor as one of the content block choices, and there was content saved in the WP default visual editor, you can choose to copy it over. It's a pretty nice feature if you have legacy.
-Rich
These are great suggestions. Much of this plugin has been developed so far with a "I need feature X for my current project so I'll add it" mindset, so it's always great to have a wider view like the one you've provided here.
One at a time:
1 It's possible to extend the layouts class to add a block type. It's not well documented yet as I'm sure that I'm not doing it as cleanly as I could be, but here's what I use to add a project-specific block type:
Please note that this is super thrown together and probably very poorly executed.
/**
* Add 'Header' layout to FCB layouts
*/
class addMyLayouts extends ACFFlexibleContentBlocks {
function __construct() {
add_filter( 'fcb_add_layouts', array($this, 'my_layouts'), 10, 2);
}
function my_layouts($layouts_array) {
return $this->insert_the_layouts('myLayouts', $layouts_array);
}
} new addMyLayouts;
class myLayouts {
/**
*
* Flexible Content Field: Header
*
* @author Michael W. Delaney
*
*/
function header() {
$FCBFields = new FCBFields(__FUNCTION__);
$FCBRepeaters = new FCBRepeaters(__FUNCTION__);
return(
array ( 'order' => '1000',
'layout' => array (
'key' => __FUNCTION__,
'name' => 'header',
'label' => 'Header',
'display' => 'block',
'sub_fields' => array (
// Title
$FCBFields->title(),
)
)
)
);
}
}
2 I typically accomplish this with an action rather than with ACF's "Hide on Screen" functionality. Example:
add_action('init', 'remove_content_editor');
function remove_content_editor() {
remove_post_type_support( 'page', 'editor' );
}
I'd be happy to look at a PR for this functionality, though.
3 This is a great feature, but not one I am currently planning to implement. This is another case where I'd be happy to look at a PR if you wanted to submit one.
thanks @MWDelaney we're going to start by building a plugin that adds content blocks into your setup. We'll pass along info soon