admin-menu-settings.html.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <div class="wrap">
  2. <h1><?php _e( 'Settings', 'ninja-forms' ); ?></h1>
  3. <h2 class="nav-tab-wrapper">
  4. <?php foreach( $tabs as $tab => $name ): ?>
  5. <?php if( $tab == $active_tab ): ?>
  6. <span class="nav-tab nav-tab-active"><?php echo $name ?></span>
  7. <?php else: ?>
  8. <a href="<?php echo add_query_arg( 'tab', $tab );?>" target="" class="nav-tab "><?php echo $name ?></a>
  9. <?php endif; ?>
  10. <?php endforeach; ?>
  11. </h2>
  12. <div id="poststuff">
  13. <?php if( 'settings' != $active_tab ): ?>
  14. <?php do_meta_boxes('nf_settings_' . $active_tab, 'advanced', NULL ); ?>
  15. <?php else: ?>
  16. <form action="" method="POST">
  17. <?php if( $errors ): ?>
  18. <?php foreach( $errors as $error_id => $error ): ?>
  19. <?php $message = $error . " <a href='#$error_id'>" . __( 'Fix it.', 'ninja-forms' ) . '</a>'; ?>
  20. <?php Ninja_Forms::template( 'admin-notice.html.php', array( 'class' => 'error', 'message' => $message ) ); ?>
  21. <?php endforeach; ?>
  22. <?php endif; ?>
  23. <?php foreach( $grouped_settings as $group => $settings ) : ?>
  24. <div id="ninja_forms_metabox_<?php echo $group; ?>_settings" class="postbox">
  25. <span class="item-controls">
  26. <a class="item-edit metabox-item-edit" id="edit_id" title="<?php _e( 'Edit Menu Item', 'ninja-forms' ); ?>" href="#"><?php _e( 'Edit Menu Item', 'ninja-forms' ); ?></a>
  27. </span>
  28. <h3 class="hndle"><span><?php echo $groups[ $group ][ 'label' ]; ?></span></h3>
  29. <div class="inside" style="">
  30. <table class="form-table">
  31. <tbody>
  32. <?php foreach( $settings as $key => $setting ) : ?>
  33. <?php if( 'prompt' == $setting[ 'type' ] ) continue; ?>
  34. <tr id="row_<?php echo $setting[ 'id' ]; ?>">
  35. <th scope="row">
  36. <label for="<?php echo $setting[ 'id' ]; ?>"><?php echo $setting[ 'label' ]; ?></label>
  37. </th>
  38. <td>
  39. <?php
  40. switch ( $setting[ 'type' ] ) {
  41. case 'html':
  42. echo $setting[ 'html'];
  43. break;
  44. case 'desc' :
  45. echo $setting[ 'value' ];
  46. break;
  47. case 'textbox' :
  48. echo "<input type='text' class='code widefat' name='{$setting['id']}' id='{$setting['id']}' value='{$setting['value']}'>";
  49. break;
  50. case 'password' :
  51. echo "<input type='password' class='code widefat' name='{$setting['id']}' id='{$setting['id']}' value='{$setting['value']}'>";
  52. break;
  53. case 'checkbox' :
  54. $checked = ( $setting[ 'value' ] ) ? 'checked' : '';
  55. echo "<input type='hidden' name='{$setting['id']}' value='0'>";
  56. echo "<input type='checkbox' name='{$setting['id']}' value='1' id='{$setting['id']}' class='widefat' $checked>";
  57. break;
  58. case 'select' :
  59. echo "<select name='{$setting['id']}' id='{$setting['id']}'>";
  60. foreach( $setting['options'] as $option ) {
  61. $selected = ( $setting['value'] == $option['value'] ) ? 'selected="selected"' : '';
  62. echo "<option value='{$option['value']}' {$selected}>{$option['label']}</option>";
  63. }
  64. echo "</select>";
  65. break;
  66. }
  67. if( isset( $setting[ 'desc' ] ) ) {
  68. echo "<p class='description'>" . $setting[ 'desc' ] . "</p>";
  69. }
  70. ?>
  71. <?php
  72. if( isset( $setting[ 'errors' ] ) ){
  73. foreach( $setting[ 'errors' ] as $error_id => $error ){
  74. echo "<div id='$error_id' class='error'><p>$error</p></div>";
  75. }
  76. }
  77. ?>
  78. </td>
  79. </tr>
  80. </tbody>
  81. <?php endforeach; ?>
  82. </table>
  83. </div>
  84. </div>
  85. <?php endforeach; ?>
  86. <input type="hidden" name="update_ninja_forms_settings">
  87. <input type="submit" class="button button-primary" value="<?php echo $save_button_text; ?>">
  88. </form>
  89. <?php endif; ?>
  90. </div>
  91. </div>