public function html()
{
// Buffering...
WPDKHTML::startCompress();
foreach ($this->_cla as $key => $value) {
?>
<?php
if (empty($key) || empty($value)) {
continue;
}
?>
<?php
// Check for collapse fieldset
$collpase_class = '';
if ('+' == substr($key, 0, 1)) {
$collpase_class = 'wpdk-fieldset-collapse wpdk-fieldset-collapse-open';
$key = ltrim($key, '+');
} elseif ('-' == substr($key, 0, 1)) {
$collpase_class = 'wpdk-fieldset-collapse wpdk-fieldset-collapse-close';
$key = ltrim($key, '-');
}
?>
<fieldset class="wpdk-form-fieldset wpdk-ui-control <?php
echo $collpase_class;
?>
">
<legend><?php
echo $key;
?>
</legend>
<div class="wpdk-fieldset-container">
<?php
$this->_processRows($value);
?>
</div>
</fieldset>
<?php
}
return WPDKHTML::endCompress();
}
/** * Display * * @brief Display */ public function draw() { // Create a nonce key $nonce = md5($this->id); $input_hidden_nonce = new WPDKHTMLTagInput('', $nonce, $nonce); $input_hidden_nonce->type = WPDKHTMLTagInputType::HIDDEN; $input_hidden_nonce->value = wp_create_nonce($this->id); $input_hidden_class = new WPDKHTMLTagInput('', 'wpdk_preferences_class'); $input_hidden_class->type = WPDKHTMLTagInputType::HIDDEN; $input_hidden_class->value = get_class($this->preferences); $input_hidden_branch = new WPDKHTMLTagInput('', 'wpdk_preferences_branch'); $input_hidden_branch->type = WPDKHTMLTagInputType::HIDDEN; $input_hidden_branch->value = $this->branch_property; $layout = new WPDKUIControlsLayout($this->fields($this->branch)); $form = new WPDKHTMLTagForm($input_hidden_nonce->html() . $input_hidden_class->html() . $input_hidden_branch->html() . $layout->html() . $this->buttonsUpdateReset()); $form->name = 'wpdk_preferences_view_form-' . $this->branch_property; $form->id = $form->name; $form->class[] = 'wpdk-form wpdk-preferences-view-' . $this->branch_property; $form->method = 'post'; $form->action = ''; /** * Filter the form object for this branch view. * * @param WPDKHTMLTagForm $form An instance of WPDKHTMLTagForm class. */ $form = apply_filters('wpdk_preferences_branch_form', $form); /** * Fires before display the view. You can add your custome feedback message. */ do_action('wpdk_preferences_feedback-' . $this->branch_property); $form->display(); }