/** * Get a repeater row HTML output * * @param array The set of fields to render in the repeater * @param array The values for the fields */ protected function get_template($values = null, $template = true) { $form = new Youxi_Form($this->get_option('fields'), array('form_tag' => 'div', 'form_attr' => array('class' => 'youxi-repeater-row-content'), 'group_attr' => array('class' => 'youxi-form-row youxi-form-inline'), 'control_attr' => array('class' => 'youxi-form-item'), 'label_attr' => array('class' => 'youxi-form-label'), 'field_attr' => array('class' => array('youxi-form-large' => array('type' => array('text', 'textarea', 'url', 'select', 'iconchooser')))), 'fieldsets' => $this->get_option('fieldsets'))); $t = '<div class="youxi-repeater-row">'; $t .= '<div class="youxi-repeater-row-header">'; $t .= '<div class="youxi-repeater-row-title"></div>'; $t .= '<div class="youxi-repeater-row-controls">'; $t .= '<button type="button" class="button button-large" data-action="edit">'; $t .= '<i class="dashicons dashicons-edit"></i>'; $t .= esc_attr($this->get_option('edit_text')); $t .= '</button>'; $t .= '<button type="button" class="button button-large" data-action="remove">'; $t .= '<i class="dashicons dashicons-trash"></i>'; $t .= esc_attr($this->get_option('delete_text')); $t .= '</button>'; $t .= '</div>'; $t .= '</div>'; $t .= $form->compile($values)->render(false); $t .= '</div>'; $depth = $this->get_option('depth'); return $template ? $t : str_replace("{{ data.index_{$depth} }}", $this->index, $t); }
/** * Get the HTML output for the shortcode popup content * * @return string The popup content HTML markup */ public function get_html() { $form = new Youxi_Form($this->fields, array('form_tag' => 'div', 'form_attr' => array('class' => 'youxi-form'), 'form_method' => '', 'group_attr' => array('class' => 'youxi-form-row'), 'control_attr' => array('class' => 'youxi-form-item'), 'label_attr' => array('class' => 'youxi-form-label'), 'field_attr' => array('class' => array('youxi-form-large' => array('type' => array('text', 'textarea', 'code', 'url', 'select', 'iconchooser')))), 'fieldsets' => $this->shortcode->fieldsets)); return $form->compile($this->form_data)->render(false); }