Ejemplo n.º 1
0
 /**
  * Populate the properties array
  *
  * @param array $properties
  */
 private function populate_properties($properties)
 {
     $this->properties = papi_populate_properties($properties);
     if (!empty($this->properties)) {
         $this->options->_tab_box = isset($this->properties[0]->tab) && $this->properties[0]->tab;
     }
 }
Ejemplo n.º 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_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 
    }
Ejemplo n.º 3
0
 /**
  * Setup properties.
  *
  * @param  array $properties
  */
 protected function setup_properties(array $properties)
 {
     $this->properties = array_merge($this->properties, papi_populate_properties($properties));
 }
Ejemplo n.º 4
0
 /**
  * Setup properties.
  *
  * @param  array $properties
  */
 protected function setup_properties(array $properties)
 {
     $this->properties = papi_populate_properties($properties);
 }
    /**
     * Generate html for tabs and properties.
     */
    private function html()
    {
        ?>
		<div class="papi-tabs-wrapper">
			<div class="papi-tabs-table-back"></div>
			<div class="papi-tabs-back"></div>
			<ul class="papi-tabs">
				<?php 
        foreach ($this->tabs as $tab) {
            ?>
					<li class="<?php 
            echo $this->tabs[0] === $tab ? 'active' : '';
            ?>
">
						<a href="#" data-papi-tab="<?php 
            echo $tab->options->_name;
            ?>
">
							<?php 
            if (!empty($tab->options->icon)) {
                ?>
								<img src="<?php 
                echo $tab->options->icon;
                ?>
" alt="<?php 
                echo $tab->options->title;
                ?>
"/>
							<?php 
            }
            echo $tab->options->title;
            ?>
						</a>
					</li>
				<?php 
        }
        ?>
			</ul>
			<div class="papi-tabs-content">
				<?php 
        foreach ($this->tabs as $tab) {
            ?>
					<div class="<?php 
            echo $this->tabs[0] === $tab ? 'active' : '';
            ?>
"
					     data-papi-tab="<?php 
            echo $tab->options->_name;
            ?>
">
						<?php 
            $properties = papi_populate_properties($tab->properties);
            $properties = array_map(function ($property) {
                // While in a tab the sidebar is required.
                $property->sidebar = true;
                return $property;
            }, $properties);
            papi_render_properties($properties);
            ?>
					</div>
				<?php 
        }
        ?>
			</div>
		</div>
		<div class="papi-clear"></div>
	<?php 
    }