Advertisement
CrosCri

Untitled

Jun 15th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.08 KB | None | 0 0
  1. $fields = [
  2.             [
  3.                 'id' => 'template',
  4.                 'name' => 'Template',
  5.                 'type' => 'select',
  6.                 'options' => [
  7.                     'home' => 'Home',
  8.                     'button' => 'Button',
  9.                 ],
  10.                 'attributes' => [ 'required' => 'required' ],
  11.             ],
  12.             [
  13.                 'id' => 'home_template',
  14.                 'type' => 'group',
  15.                 'visible' => ['template', '=', 'home'],
  16.                 'fields' => [
  17.                     [
  18.                         'id' => 'visual_buttons',
  19.                         'type' => 'group',
  20.                         'clone' => true,
  21.                         'fields' => [
  22.                             [
  23.                                 'id' => 'title',
  24.                                 'name' => 'Title',
  25.                                 'type' => 'text',
  26.                                 'size' => 300,
  27.                                 'columns' => 12,
  28.                             ],
  29.                             [
  30.                                 'id' => 'description',
  31.                                 'name' => 'Description',
  32.                                 'type' => 'textarea',
  33.                                 'rows' => 3,
  34.                                 'columns' => 12,
  35.                             ],
  36.                             [
  37.                                 'id' => 'find_out_more',
  38.                                 'name' => 'Find out more',
  39.                                 'type' => 'text',
  40.                                 'size' => 300,
  41.                                 'columns' => 6,
  42.                             ],
  43.                             [
  44.                                 'id' => 'image',
  45.                                 'name' => 'Image',
  46.                                 'type' => 'single_image',
  47.                                 'columns' => 6,
  48.                             ],
  49.                             [
  50.                                 'id' => 'visual_button_link_type',
  51.                                 'type' => 'select',
  52.                                 'name' => 'Link type',
  53.                                 'options' => [
  54.                                     'none' => 'None',
  55.                                     'internal' => 'Internal',
  56.                                     'external' => 'External',
  57.                                 ],
  58.                                 'columns' => 6,
  59.                             ],
  60.                             [
  61.                                 'id' => 'visual_button_link_target',
  62.                                 'type' => 'select',
  63.                                 'name' => 'Target',
  64.                                 'options' => [
  65.                                     '_self' => 'Default',
  66.                                     '_blank' => 'Blank',
  67.                                 ],
  68.                                 'columns' => 6,
  69.                             ],
  70.                             [
  71.                                 'id' => 'visual_button_external_link',
  72.                                 'type' => 'text',
  73.                                 'name' => 'External link',
  74.                                 'size' => 300,
  75.                                 'visible' => ['visual_button_link_type', '=', 'external']
  76.                             ],
  77.                             [
  78.                                 'id' => 'visual_button_internal_link',
  79.                                 'type' => 'post',
  80.                                 'name' => 'Internal link',
  81.                                 'post_type' => ['page', 'post'],
  82.                                 'visible' => ['visual_button_link_type', '=', 'internal']
  83.                             ]
  84.                         ],
  85.                     ]
  86.                 ]
  87.             ],
  88.             [
  89.                 'id' => 'button_template',
  90.                 'type' => 'group',
  91.                 'visible' => ['template', '=', 'button'],
  92.                 'fields' => [
  93.                     [
  94.                         'id' => 'label',
  95.                         'type' => 'text',
  96.                         'name' => 'Label',
  97.                         'size' => 300,
  98.                         'columns' => 12,
  99.                     ],
  100.                     [
  101.                         'id' => 'button_link_type',
  102.                         'type' => 'select',
  103.                         'name' => 'Link type',
  104.                         'options' => [
  105.                             'none' => 'None',
  106.                             'internal' => 'Internal',
  107.                             'external' => 'External',
  108.                         ],
  109.                         'columns' => 6,
  110.                     ],
  111.                     [
  112.                         'id' => 'button_link_target',
  113.                         'type' => 'select',
  114.                         'name' => 'Target',
  115.                         'options' => [
  116.                             '_self' => 'Default',
  117.                             '_blank' => 'Blank',
  118.                         ],
  119.                         'columns' => 6,
  120.                     ],
  121.                     [
  122.                         'id' => 'button_external_link',
  123.                         'type' => 'text',
  124.                         'name' => 'External link',
  125.                         'size' => 300,
  126.                         'hidden' => ['button_link_type', '!=', 'external']
  127.                     ],
  128.                     [
  129.                         'id' => 'button_internal_link',
  130.                         'type' => 'post',
  131.                         'name' => 'Internal link',
  132.                         'post_type' => ['page', 'post'],
  133.                         'hidden' => ['button_link_type', '!=', 'internal']
  134.                     ]
  135.                 ]
  136.             ]
  137.         ];
  138.  
  139.         $meta_boxes[] = [
  140.             'title'           => 'Block',
  141.             'id'              => 'abcdef-block',
  142.             'type'            => 'block',
  143.             'category'        => 'abcdef-blocks',
  144.             'render_callback' => __CLASS__ . '::render_callback',
  145.             'fields'          => $fields,
  146.         ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement