/** * The constructor. * * @param array $tabs * @param bool $render */ public function __construct(array $tabs = [], $render = true) { if (empty($tabs)) { return; } $this->tabs = papi_tabs_setup($tabs); if ($render) { $this->html(); } }
/** * Render management box table. * * @param array $properties * @param bool $tab * */ function papi_management_page_type_render_box($properties, $tab = false) { ?> <table class="papi-table"> <thead> <tr> <?php if ($tab) { ?> <th><?php _e('Tab Title', 'papi'); ?> </th> <th><?php _e('Sort Order', 'papi'); ?> </th> <th><?php _e('Properties', 'papi'); ?> </th> <?php } else { ?> <th><?php _e('Title', 'papi'); ?> </th> <th><?php _e('Type', 'papi'); ?> </th> <th><?php _e('Slug', 'papi'); ?> </th> <th><?php _e('Sort Order', 'papi'); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php $properties = papi_populate_properties($properties); if ($tab) { $properties = papi_tabs_setup($properties); } foreach ($properties as $property) { ?> <tr> <?php if ($tab) { ?> <td> <?php echo esc_html($property->title); ?> <br /> <br /> <?php echo __('Properties', 'papi') . ': ' . strval(count($property->properties)); ?> </td> <td> <?php echo esc_html($property->sort_order); ?> </td> <td> <?php papi_management_page_type_render_box($property->properties); ?> </td> <?php } else { ?> <td><?php echo esc_html($property->title); ?> </td> <td><?php echo strtolower(esc_html($property->type)); ?> </td> <td><?php echo esc_html($property->get_slug(true)); ?> </td> <td><?php echo esc_html($property->sort_order); ?> </td> <?php } ?> </tr> <?php } ?> </tr> </tbody> </table> <?php }