コード例 #1
0
 /**
  * The constructor.
  *
  * @param array $tabs
  * @param bool  $render
  */
 public function __construct($tabs = [], $render = true)
 {
     if (empty($tabs)) {
         return;
     }
     $this->tabs = papi_setup_tabs($tabs);
     if ($render) {
         $this->html();
     }
 }
コード例 #2
0
    /**
     * 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_setup_tabs($properties);
        }
        foreach ($properties as $property) {
            ?>
					<tr>
						<?php 
            if (isset($property->options) && isset($property->options->title)) {
                ?>
							<td>
								<?php 
                echo esc_html($property->options->title);
                ?>
								<br />
								<br />
								<?php 
                echo __('Properties', 'papi') . ': ' . strval(count($property->properties));
                ?>
							</td>
							<td>
								<?php 
                echo esc_html($property->options->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 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 
    }