Advertisement
Guest User

Clone group inside MB Block

a guest
Oct 24th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1.   $meta_boxes[] = [
  2.     'title'           => 'Button',
  3.     'id'              => 'btn',
  4.     'description'     => 'Inserts buttons that are either stacked or inline, primary or standard styling.',
  5.     'type'            => 'block',
  6.     'icon'            => 'admin-links',
  7.     'category'        => 'formatting',
  8.     'keywords'        => ['button', 'link', 'action', 'cta'],
  9.     'render_template' => get_template_directory() . '/blocks/btn.php',
  10.     'enqueue_style'   => $wp_admin_css,
  11.     'supports'        => [
  12.       'align' => ['wide', 'full'],
  13.     ],
  14.     'fields'     => [
  15.       [
  16.         'id'         => 'btn_group',
  17.         'type'       => 'group',
  18.         'clone'      => true,
  19.         'add_button' => '+ Add another button',
  20.         'fields'     => [
  21.           [
  22.             'id'   => 'btn_txt',
  23.             'type' => 'text',
  24.             'name' => 'Button text'
  25.           ],
  26.           [
  27.             'id'   => 'btn_url',
  28.             'type' => 'text',
  29.             'name' => 'Button link'
  30.           ],
  31.           [
  32.             'id'      => 'btn_stacked',
  33.             'name'    => 'Stacked',
  34.             'type'    => 'select',
  35.             'options' => array(
  36.               '1' => 'Yes',
  37.               '0' => 'No'
  38.             )
  39.           ],
  40.           [
  41.             'id'      => 'btn_style',
  42.             'name'    => 'Style',
  43.             'type'    => 'select',
  44.             'options' => array(
  45.               'primary'  => 'Primary (pink)',
  46.               'standard' => 'Standard (blue)'
  47.             )
  48.           ]
  49.         ]
  50.       ]
  51.     ]
  52.   ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement