Home › Forums › Gutenberg › Inserter Help Panel › Reply To: Inserter Help Panel
Hi All,
I could do with some help on the inserter help panel.
I have the following code:
// register a one column block
acf_register_block_type(
array(
'name' => 'one-column',
'title' => __('One Column'),
'description' => __('A one column block.'),
'render_template' => get_template_directory() . '/blocks/content-one-column.php',
'icon' => 'menu',
#'icon' => file_get_contents( get_template_directory() . '/images/blocks/one-column.svg' ),
#'mode' => 'auto', #Available settings are auto, preview and edit.
'supports' => array( 'align' => false ),
'keywords' => array( 'one column', 'layout' ),
#'render_template' => get_template_directory() . '/blocks/content-one-column.php',
#'enqueue_script' => get_template_directory_uri() . '/blocks/content-one-column.js',
'example' => array(
'mode' => 'preview',
'attributes' => array(
'data' => array(
#'title' => "One Column Block",
'content' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod sem eget tortor suscipit, et ultricies lectus ultrices.",
#'content' => '<img src="'.get_template_directory_uri() . '/images/block-preview/one-column.jpg'.'">'
#'gutenberg_preview' => __('<img src="'.get_template_directory_uri() . '/images/block-preview/one-column.jpg'.'">'),
)
)
)
)
);
My template (blocks/content-one-column.php) includes the fields:
– title
– content
So my understanding is you use those in the ‘data’ field and when you hover over the block you want to add, it would then show this content.
I replaced this with an image (thought it would be easier to style). Oddly, this was working but has now stopped. I can’t even get the previous one to work.
Am I right in thinking you just need the above? You don’t need to enqueue_script a js file?
Be great to get this working, so any pointers are very much appreciated!
Thanks
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.