Settings API: enhance multiselect fileds

Add optional "select all"/"select none" buttons to multiselect fields,
similarly to what already exists for the country field.
This commit is contained in:
Joey Kudish 2016-01-14 22:07:31 -08:00
parent ea7b0adcc7
commit 7bb99af123
1 changed files with 4 additions and 0 deletions

View File

@ -666,6 +666,7 @@ abstract class WC_Settings_API {
'desc_tip' => false,
'description' => '',
'custom_attributes' => array(),
'allbuttons' => false,
'options' => array()
);
@ -688,6 +689,9 @@ abstract class WC_Settings_API {
<?php endforeach; ?>
</select>
<?php echo $this->get_description_html( $data ); ?>
<?php if ( $data['allbuttons'] ) : ?>
<br/><a class="select_all button" href="#"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select none', 'woocommerce' ); ?></a>
<?php endif; ?>
</fieldset>
</td>
</tr>