Community Forums › Forums › Genesis Custom Blocks › Programmatically creating a repeater block.
Tagged: development, Genesis Custom Blocks
- This topic has 0 replies, 1 voice, and was last updated 3 weeks, 3 days ago by
bishopdz.
-
AuthorPosts
-
April 29, 2022 at 8:36 am #505157
bishopdz
ParticipantHello, my development team is using Genesis Custom Blocks to programmatically create blocks that are stored and reused in our git repo. I am trying to code a repeater block but I am stuck because I have not been able to find any examples of this. Here is what I have tried that seems syntactically correct.
1:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeater' => array(
'name' => 'repeater',
'label' => 'Repeater',
'control' => 'repeater',
'type' => 'text',
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');2:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeater' => array(
'name' => 'repeater',
'label' => 'Repeater',
'control' => 'repeater',
'field' => 'text',
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');3:
<?phpuse function Genesis\CustomBlocks\add_block;
function add_fees_block() {
// One long array with lots defined.
add_block(
'fees',
array(
'title' => 'Fees Block',
'category' => 'common',
'icon' => 'account_circle',
'fields' => array(
'repeat' => array(
'name' => 'repeat',
'label' => 'Repeater',
'control' => 'repeater',
'fields' => array('text' => array(
'name' => 'text',
'label' => 'Text',
'control' => 'text',
),
),
),
),
),
);
}
add_action( 'genesis_custom_blocks_add_blocks', 'add_fees_block');I am unsure if it is even possible but it would help us a lot.
Thank you for your time. -
AuthorPosts
- You must be logged in to reply to this topic.