| 1 |
<?php defined( 'ABSPATH' ) or exit; |
| 2 |
|
| 3 |
$tabs = hf_get_admin_tabs($form); |
| 4 |
|
| 5 |
?> |
| 6 |
<script>document.title = 'Edit form' + ' - ' + document.title;</script> |
| 7 |
<div class="wrap hf"> |
| 8 |
|
| 9 |
<p class="breadcrumbs"> |
| 10 |
<span class="prefix"><?php echo __( 'You are here: ', 'html-forms' ); ?></span> |
| 11 |
<a href="<?php echo admin_url( 'admin.php?page=html-forms' ); ?>">HTML Forms</a> › |
| 12 |
<span class="current-crumb"><strong><?php _e( 'Edit form', 'html-forms' ); ?></strong></span> |
| 13 |
</p> |
| 14 |
|
| 15 |
<h1 class="page-title"><?php _e( 'Edit form', 'html-forms' ); ?></h1> |
| 16 |
|
| 17 |
<?php if ( ! empty( $_GET['saved'] ) ) { |
| 18 |
echo '<div class="notice notice-success"><p>' . __( 'Form updated.', 'html-forms' ) . '</p></div>'; |
| 19 |
} ?> |
| 20 |
|
| 21 |
<form method="post"> |
| 22 |
<input type="hidden" name="_hf_admin_action" value="save_form" /> |
| 23 |
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce('_hf_admin_action') ); ?>" /> |
| 24 |
<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->ID ); ?>" /> |
| 25 |
<input type="submit" style="display: none; " /> |
| 26 |
|
| 27 |
<div id="titlediv"> |
| 28 |
<div id="titlewrap"> |
| 29 |
<label for="title"><?php _e( 'Form title', 'html-forms' ); ?></label> |
| 30 |
<input type="text" name="form[title]" size="30" value="<?php echo esc_attr( $form->title ); ?>" id="title" spellcheck="true" autocomplete="off" placeholder="<?php echo __( "Enter the title of your form", 'html-forms' ); ?>" style="line-height: initial;" > |
| 31 |
</div> |
| 32 |
<div class="inside" style="margin-top: 3px;"> |
| 33 |
<div class="hf-tiny-margin hide-if-no-js"> |
| 34 |
<strong>Slug:</strong> <input type="text" id="form-slug-input" name="form[slug]" value="<?php echo esc_attr( $form->slug ); ?>" readonly /> ‎<button type="button" class="button button-small" onclick="document.getElementById('form-slug-input').removeAttribute('readonly');" aria-label="<?php _e( 'Edit slug', 'html-forms' ); ?>"><?php _e( 'Edit', 'html-forms' ); ?></button> |
| 35 |
</div> |
| 36 |
<div class="hf-tiny-margin"> |
| 37 |
<label for="shortcode"><?php _e( 'Copy this shortcode and paste it into your post, page, or text widget content:', 'html-forms' ); ?></label><br /> |
| 38 |
<input id="shortcode" type="text" class="regular-text" value="<?php echo esc_attr( sprintf( '[hf_form slug="%s"]', $form->slug ) ); ?>" readonly onclick="this.select()"> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
</div> |
| 42 |
|
| 43 |
<div class="hf-small-margin"> |
| 44 |
<h2 class="nav-tab-wrapper" id="hf-tabs-nav"> |
| 45 |
<?php foreach( $tabs as $tab => $name ) { |
| 46 |
$class = ( $active_tab === $tab ) ? 'nav-tab-active' : ''; |
| 47 |
echo sprintf( '<a class="nav-tab nav-tab-%s %s" data-tab-target="%s" href="%s">%s</a>', $tab, $class, $tab, $this->get_tab_url( $tab ), $name ); |
| 48 |
} ?> |
| 49 |
</h2> |
| 50 |
|
| 51 |
<div id="tabs"> |
| 52 |
<?php |
| 53 |
// output each tab |
| 54 |
foreach( $tabs as $tab => $name ) { |
| 55 |
$class = ($active_tab === $tab) ? 'hf-tab-active' : ''; |
| 56 |
echo sprintf('<div class="hf-tab %s" id="tab-%s" data-tab="%s">', $class, $tab, $tab); |
| 57 |
do_action( 'hf_admin_output_form_tab_' . $tab, $form ); |
| 58 |
echo '</div>'; |
| 59 |
} // end foreach tab |
| 60 |
?> |
| 61 |
|
| 62 |
</div><!-- / tabs --> |
| 63 |
</div> |
| 64 |
|
| 65 |
</form> |
| 66 |
|
| 67 |
<?php require __DIR__ . '/admin-footer.php'; ?> |
| 68 |
</div> |
| 69 |
|