暂无描述

field-group-options.php 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. // global
  3. global $field_group;
  4. // active
  5. acf_render_field_wrap(
  6. array(
  7. 'label' => __( 'Active', 'acf' ),
  8. 'instructions' => '',
  9. 'type' => 'true_false',
  10. 'name' => 'active',
  11. 'prefix' => 'acf_field_group',
  12. 'value' => $field_group['active'],
  13. 'ui' => 1,
  14. // 'ui_on_text' => __('Active', 'acf'),
  15. // 'ui_off_text' => __('Inactive', 'acf'),
  16. )
  17. );
  18. // Show fields in REST API.
  19. if ( acf_get_setting( 'rest_api_enabled' ) ) {
  20. acf_render_field_wrap(
  21. array(
  22. 'label' => __( 'Show in REST API', 'acf' ),
  23. 'instructions' => '',
  24. 'type' => 'true_false',
  25. 'name' => 'show_in_rest',
  26. 'prefix' => 'acf_field_group',
  27. 'value' => $field_group['show_in_rest'],
  28. 'ui' => 1,
  29. // 'ui_on_text' => __('Active', 'acf'),
  30. // 'ui_off_text' => __('Inactive', 'acf'),
  31. )
  32. );
  33. }
  34. // style
  35. acf_render_field_wrap(
  36. array(
  37. 'label' => __( 'Style', 'acf' ),
  38. 'instructions' => '',
  39. 'type' => 'select',
  40. 'name' => 'style',
  41. 'prefix' => 'acf_field_group',
  42. 'value' => $field_group['style'],
  43. 'choices' => array(
  44. 'default' => __( 'Standard (WP metabox)', 'acf' ),
  45. 'seamless' => __( 'Seamless (no metabox)', 'acf' ),
  46. ),
  47. )
  48. );
  49. // position
  50. acf_render_field_wrap(
  51. array(
  52. 'label' => __( 'Position', 'acf' ),
  53. 'instructions' => '',
  54. 'type' => 'select',
  55. 'name' => 'position',
  56. 'prefix' => 'acf_field_group',
  57. 'value' => $field_group['position'],
  58. 'choices' => array(
  59. 'acf_after_title' => __( 'High (after title)', 'acf' ),
  60. 'normal' => __( 'Normal (after content)', 'acf' ),
  61. 'side' => __( 'Side', 'acf' ),
  62. ),
  63. 'default_value' => 'normal',
  64. )
  65. );
  66. // label_placement
  67. acf_render_field_wrap(
  68. array(
  69. 'label' => __( 'Label placement', 'acf' ),
  70. 'instructions' => '',
  71. 'type' => 'select',
  72. 'name' => 'label_placement',
  73. 'prefix' => 'acf_field_group',
  74. 'value' => $field_group['label_placement'],
  75. 'choices' => array(
  76. 'top' => __( 'Top aligned', 'acf' ),
  77. 'left' => __( 'Left aligned', 'acf' ),
  78. ),
  79. )
  80. );
  81. // instruction_placement
  82. acf_render_field_wrap(
  83. array(
  84. 'label' => __( 'Instruction placement', 'acf' ),
  85. 'instructions' => '',
  86. 'type' => 'select',
  87. 'name' => 'instruction_placement',
  88. 'prefix' => 'acf_field_group',
  89. 'value' => $field_group['instruction_placement'],
  90. 'choices' => array(
  91. 'label' => __( 'Below labels', 'acf' ),
  92. 'field' => __( 'Below fields', 'acf' ),
  93. ),
  94. )
  95. );
  96. // menu_order
  97. acf_render_field_wrap(
  98. array(
  99. 'label' => __( 'Order No.', 'acf' ),
  100. 'instructions' => __( 'Field groups with a lower order will appear first', 'acf' ),
  101. 'type' => 'number',
  102. 'name' => 'menu_order',
  103. 'prefix' => 'acf_field_group',
  104. 'value' => $field_group['menu_order'],
  105. )
  106. );
  107. // description
  108. acf_render_field_wrap(
  109. array(
  110. 'label' => __( 'Description', 'acf' ),
  111. 'instructions' => __( 'Shown in field group list', 'acf' ),
  112. 'type' => 'text',
  113. 'name' => 'description',
  114. 'prefix' => 'acf_field_group',
  115. 'value' => $field_group['description'],
  116. )
  117. );
  118. // hide on screen
  119. $choices = array(
  120. 'permalink' => __( 'Permalink', 'acf' ),
  121. 'the_content' => __( 'Content Editor', 'acf' ),
  122. 'excerpt' => __( 'Excerpt', 'acf' ),
  123. 'custom_fields' => __( 'Custom Fields', 'acf' ),
  124. 'discussion' => __( 'Discussion', 'acf' ),
  125. 'comments' => __( 'Comments', 'acf' ),
  126. 'revisions' => __( 'Revisions', 'acf' ),
  127. 'slug' => __( 'Slug', 'acf' ),
  128. 'author' => __( 'Author', 'acf' ),
  129. 'format' => __( 'Format', 'acf' ),
  130. 'page_attributes' => __( 'Page Attributes', 'acf' ),
  131. 'featured_image' => __( 'Featured Image', 'acf' ),
  132. 'categories' => __( 'Categories', 'acf' ),
  133. 'tags' => __( 'Tags', 'acf' ),
  134. 'send-trackbacks' => __( 'Send Trackbacks', 'acf' ),
  135. );
  136. if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
  137. unset( $choices['custom_fields'] );
  138. }
  139. acf_render_field_wrap(
  140. array(
  141. 'label' => __( 'Hide on screen', 'acf' ),
  142. 'instructions' => __( '<b>Select</b> items to <b>hide</b> them from the edit screen.', 'acf' ) . '<br /><br />' . __( "If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)", 'acf' ),
  143. 'type' => 'checkbox',
  144. 'name' => 'hide_on_screen',
  145. 'prefix' => 'acf_field_group',
  146. 'value' => $field_group['hide_on_screen'],
  147. 'toggle' => true,
  148. 'choices' => $choices,
  149. )
  150. );
  151. // 3rd party settings
  152. do_action( 'acf/render_field_group_settings', $field_group );
  153. ?>
  154. <div class="acf-hidden">
  155. <input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
  156. </div>
  157. <script type="text/javascript">
  158. if( typeof acf !== 'undefined' ) {
  159. acf.newPostbox({
  160. 'id': 'acf-field-group-options',
  161. 'label': 'left'
  162. });
  163. }
  164. </script>