/** * Handles the display of the party people field options. * Interacts with the plugin options panel to manage options of this field. * * @access public * @since 1.0.0 * @return array $party_options holds all the options from the plugin settings panel * @todo finish integration with options panel */ public function wprm_get_party_amount() { $party_options = wprm_get_party_sizes(); $party_sizes = array(); foreach ($party_options as $table => $value) { $party_sizes[$value['size']] = $value['size']; } return apply_filters('wprm_party_options', $party_sizes); }
/** * Table Sizes Callback * * Renders table sizes table * * @since 1.0.0 * @param array $args Arguments passed by the setting * @global $wprm_options Array of all the WPRM Options * @return void */ function wprm_party_sizes_callback($args) { global $wprm_options; $sizes = wprm_get_party_sizes(); ob_start(); ?> <p><?php echo $args['desc']; ?> </p> <table id="wprm_party_sizes" class="wp-list-table widefat fixed posts"> <thead> <tr> <th scope="col" class="wprm_party_size"><?php _e('Table Sizes/Party Sizes', 'wprm'); ?> </th> <th scope="col"><?php _e('Remove', 'wprm'); ?> </th> </tr> </thead> <?php if (!empty($sizes)) { ?> <?php foreach ($sizes as $key => $rate) { ?> <tr> <td class="wprm_party_size"> <?php echo WPRM()->html->text(array('name' => 'party_sizes[' . $key . '][size]', 'value' => $rate['size'])); ?> </td> <td><span class="wprm_remove_party_size button-secondary"><?php _e('Remove Size', 'wprm'); ?> </span></td> </tr> <?php } ?> <?php } else { ?> <tr> <td class="wprm_party_size"> <?php echo WPRM()->html->text(array('name' => 'party_sizes[0][size]')); ?> </td> <td><span class="wprm_remove_party_size button-secondary"><?php _e('Remove Size', 'wprm'); ?> </span></td> </tr> <?php } ?> </table> <p> <span class="button-secondary" id="wprm_add_party_size"><?php _e('Add Option', 'wprm'); ?> </span> </p> <?php echo ob_get_clean(); }