Advertisement
longnguyenwp

group conditional logic

Sep 23rd, 2020 (edited)
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.92 KB | None | 0 0
  1. array(
  2.     'name'        => __( 'Plans' ),
  3.     'id'          => 'plans',
  4.     'type'        => 'group',
  5.  
  6.     'clone'       => true,
  7.     'sort_clone'  => true,
  8.     'collapsible' => true,
  9.     'save_state'  => true,
  10.     'group_title' => __( 'Plan' ) . ' - {title}',
  11.     'add_button'  => __( 'Add Plan' ),
  12.     'visible'     => array( 'pricing_type', '=', 'table' ), // ======================== here ======================
  13.     'fields'      => array(
  14.         array(
  15.             'name' => __( 'Title' ),
  16.             'id'   => 'title',
  17.             'type' => 'text',
  18.  
  19.             'size' => 40,
  20.         ),
  21.         array(
  22.             'name'    => __( 'Price prefix' ),
  23.             'id'      => 'price_prefix',
  24.             'type'    => 'text',
  25.  
  26.             'columns' => 3,
  27.         ),
  28.         array(
  29.             'name'     => __( 'Price' ),
  30.             'id'       => 'price',
  31.             'type'     => 'number',
  32.  
  33.             'step'     => 0.01,
  34.  
  35.             'required' => true,
  36.             'columns'  => 3,
  37.             'hidden'   => array( 'seperate_pricing', true ),
  38.         ),
  39.         array(
  40.             'name'     => __( 'Price monthly' ),
  41.             'id'       => 'price_monthly',
  42.             'type'     => 'number',
  43.  
  44.             'step'     => 0.01,
  45.  
  46.             'required' => true,
  47.             'columns'  => 3,
  48.             'visible'  => array( 'seperate_pricing', true ),
  49.         ),
  50.         array(
  51.             'name'     => __( 'Price yearly' ),
  52.             'id'       => 'price_yearly',
  53.             'type'     => 'number',
  54.  
  55.             'step'     => 0.01,
  56.  
  57.             'required' => true,
  58.             'columns'  => 3,
  59.             'visible'  => array( 'seperate_pricing', true ),
  60.         ),
  61.         array(
  62.             'id'      => 'btn',
  63.             'type'    => 'group',
  64.  
  65.             'visible' => array( 'pricing_type', '=', 'simple' ),
  66.  
  67.             'fields'  => array(
  68.                 array(
  69.                     'name' => __( 'Label' ),
  70.                     'id'   => 'label',
  71.                     'type' => 'text',
  72.                 ),
  73.                 array(
  74.                     'name' => __( 'URL' ),
  75.                     'id'   => 'url',
  76.                     'type' => 'text',
  77.                 ),
  78.             ),
  79.         ),
  80.         array(
  81.             'id'          => 'features',
  82.             'type'        => 'group',
  83.  
  84.             'clone'       => true,
  85.             'sort_clone'  => true,
  86.             'collapsible' => true,
  87.             'save_state'  => true,
  88.             'group_title' => '{#}. ' . __( 'Feature' ),
  89.             'add_button'  => __( 'Add Feature' ),
  90.  
  91.            
  92.  
  93.             'fields'      => array(
  94.                 array(
  95.                     'name'    => __( 'Checked' ),
  96.                     'id'      => 'checked',
  97.                     'type'    => 'switch',
  98.  
  99.                     'visible' => array( 'pricing_enable_icons', true ),
  100.                 ),
  101.                 array(
  102.                     'name' => __( 'Description' ),
  103.                     'id'   => 'desc',
  104.                     'type' => 'text',
  105.  
  106.                     'size' => 60,
  107.                 ),
  108.                 array(
  109.                     'id'          => 'sub_features',
  110.                     'type'        => 'group',
  111.  
  112.                     'clone'       => true,
  113.                     'sort_clone'  => true,
  114.                     'collapsible' => true,
  115.                     'save_state'  => true,
  116.                     'group_title' => __( 'Sub Feature' ),
  117.                     'add_button'  => __( 'Add Sub Feature' ),
  118.  
  119.                     'visible'     => array( 'pricing_enable_icons', true ),
  120.  
  121.                     'fields'      => array(
  122.                         array(
  123.                             'name' => __( 'Checked' ),
  124.                             'id'   => 'checked',
  125.                             'type' => 'switch',
  126.                         ),
  127.                     ),
  128.                 ),
  129.             ),
  130.         ),
  131.     ),
  132. ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement