field-group-locations.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // global
  3. global $field_group;
  4. ?>
  5. <div class="acf-field">
  6. <div class="acf-label">
  7. <label><?php _e( 'Rules', 'acf' ); ?></label>
  8. <i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Create a set of rules to determine which edit screens will use these advanced custom fields', 'acf' ); ?>">?</i>
  9. </div>
  10. <div class="acf-input">
  11. <div class="rule-groups">
  12. <?php
  13. foreach ( $field_group['location'] as $i => $group ) :
  14. // bail early if no group
  15. if ( empty( $group ) ) {
  16. return;
  17. }
  18. // view
  19. acf_get_view(
  20. 'html-location-group',
  21. array(
  22. 'group' => $group,
  23. 'group_id' => "group_{$i}",
  24. )
  25. );
  26. endforeach;
  27. ?>
  28. <h4><?php _e( 'or', 'acf' ); ?></h4>
  29. <a href="#" class="button add-location-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
  30. </div>
  31. </div>
  32. </div>
  33. <script type="text/javascript">
  34. if( typeof acf !== 'undefined' ) {
  35. acf.newPostbox({
  36. 'id': 'acf-field-group-locations',
  37. 'label': 'left'
  38. });
  39. }
  40. </script>