/** * AdminDisplay * * @param $post */ public function AdminDisplay($post) { wp_nonce_field($this->boxId, $this->boxId . '_nonce'); ?> <table class="form-table"> <?php foreach ($this->fields as $fieldKey => $fieldData) { ?> <tr valign="top"> <?php if ($fieldData['type'] == 'title') { ?> <th colspan="2"><h2 class="title"><?php echo $fieldData['label']; ?> </h2></th> <?php } else { ?> <th scope="row"><label for="<?php echo $fieldKey; ?> "><?php echo $fieldData['label']; ?> </label></th> <td> <?php $value = get_post_meta($post->ID, $fieldKey, true); if (!empty($fieldData['type']) && method_exists('ST\\Components\\Wordpress\\Helpers\\Fields', $fieldData['type'])) { call_user_func('ST\\Components\\Wordpress\\Helpers\\Fields::' . $fieldData['type'], $fieldKey, $value, $fieldData); } else { Fields::text($fieldKey, $value, $fieldData); } ?> </td> <?php } ?> </tr> <?php } ?> </table> <?php }
/** * SettingsPage * Wordpress admin page display (form) */ public function SettingsPage() { ?> <div class="wrap"> <h2><?php echo $this->pageTitle; ?> </h2> <form method="post" action="options.php"> <?php settings_fields($this->optionSlug); ?> <?php do_settings_sections($this->optionSlug); ?> <table class="form-table"> <?php foreach ($this->fields as $fieldKey => $fieldData) { ?> <tr valign="top"> <?php if ($fieldData['type'] == 'title') { ?> <th colspan="2"><h3 class="title"><?php echo $fieldData['label']; ?> </h3></th> <?php } else { ?> <th scope="row"><label for="<?php echo $fieldKey; ?> "><?php echo $fieldData['label']; ?> </label></th> <td> <?php $value = get_option($fieldKey); if (!empty($fieldData['type']) && method_exists('ST\\Components\\Wordpress\\Helpers\\Fields', $fieldData['type'])) { call_user_func('ST\\Components\\Wordpress\\Helpers\\Fields::' . $fieldData['type'], $fieldKey, $value, $fieldData); } else { Fields::text($fieldKey, $value, $fieldData); } ?> </td> <?php } ?> </tr> <?php } ?> </table> <?php submit_button(); ?> </form> </div> <?php }