| 1 |
<?php |
| 2 |
$available_actions = $this->get_available_form_actions(); |
| 3 |
?> |
| 4 |
|
| 5 |
<div> |
| 6 |
<h2><?php echo __( 'Form Actions', 'html-forms' ); ?></h2> |
| 7 |
|
| 8 |
<div id="hf-form-actions"> |
| 9 |
<?php |
| 10 |
if( ! empty( $form->settings['actions'] ) ) { |
| 11 |
$index = 0; |
| 12 |
foreach ($form->settings['actions'] as $action_settings ) { |
| 13 |
?> |
| 14 |
<div class="hf-action-settings" data-title="<?php echo esc_attr( $available_actions[ $action_settings['type'] ] ); ?>"> |
| 15 |
<?php do_action( 'hf_render_form_action_' . $action_settings['type'] . '_settings', $action_settings, $index++ ); ?> |
| 16 |
</div> |
| 17 |
<?php |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
echo '<p id="hf-form-actions-empty">' . __( 'No form actions configured for this form.', 'html-forms' ) . '</p>'; |
| 22 |
?> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
|
| 26 |
<div class="hf-medium-margin"> |
| 27 |
<h3><?php echo __( 'Add form action', 'html-forms' ); ?></h3> |
| 28 |
<p><?php _e( 'Use the below button(s) to configure and perform an action whenever this form is successfully submitted.', 'html-forms' ); ?></p> |
| 29 |
<p id="hf-available-form-actions"> |
| 30 |
<?php |
| 31 |
foreach( $available_actions as $type => $label ) { |
| 32 |
echo sprintf( '<input type="button" value="%s" data-action-type="%s" class="button" />', esc_html( $label ), esc_attr( $type ) ); |
| 33 |
}; |
| 34 |
?> |
| 35 |
</p> |
| 36 |
</div> |
| 37 |
|
| 38 |
<div> |
| 39 |
<?php submit_button(); ?> |
| 40 |
</div> |
| 41 |
|
| 42 |
<div style="display: none;" id="hf-form-action-templates"> |
| 43 |
<?php |
| 44 |
foreach( $available_actions as $type => $label ) { |
| 45 |
echo sprintf( '<script type="text/x-template" id="hf-action-type-%s-template">', $type ); |
| 46 |
do_action( 'hf_render_form_action_' . $type . '_settings', array(), '$index' ); |
| 47 |
echo '</script>'; |
| 48 |
} |
| 49 |
?> |
| 50 |
</div> |
| 51 |
|