Skip to content

Commit 8987165

Browse files
roidayantareq1988
authored andcommitted
Dont show submit button if there are no input fields (#49)
* Refactor tabs to spaces Signed-off-by: Roi Dayan <roi.dayan@gmail.com> * Dont show submit button if there are no input fields Can be used to add a section with information only. Like a help section. Signed-off-by: Roi Dayan <roi.dayan@gmail.com>
1 parent ecb2778 commit 8987165

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/class.settings-api.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -473,21 +473,23 @@ function show_navigation() {
473473
function show_forms() {
474474
?>
475475
<div class="metabox-holder">
476-
<?php foreach ( $this->settings_sections as $form ) { ?>
477-
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
478-
<form method="post" action="options.php">
479-
<?php
480-
do_action( 'wsa_form_top_' . $form['id'], $form );
481-
settings_fields( $form['id'] );
482-
do_settings_sections( $form['id'] );
483-
do_action( 'wsa_form_bottom_' . $form['id'], $form );
484-
?>
485-
<div style="padding-left: 10px">
486-
<?php submit_button(); ?>
487-
</div>
488-
</form>
489-
</div>
490-
<?php } ?>
476+
<?php foreach ( $this->settings_sections as $form ) { ?>
477+
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
478+
<form method="post" action="options.php">
479+
<?php
480+
do_action( 'wsa_form_top_' . $form['id'], $form );
481+
settings_fields( $form['id'] );
482+
do_settings_sections( $form['id'] );
483+
do_action( 'wsa_form_bottom_' . $form['id'], $form );
484+
if ( isset( $this->settings_fields[ $form['id'] ] ) ):
485+
?>
486+
<div style="padding-left: 10px">
487+
<?php submit_button(); ?>
488+
</div>
489+
<?php endif; ?>
490+
</form>
491+
</div>
492+
<?php } ?>
491493
</div>
492494
<?php
493495
$this->script();

0 commit comments

Comments
 (0)