public function form($instance) { $templates = \Podlove\Model\Template::all_globally(); $title = isset($instance['title']) ? $instance['title'] : ''; $selected_template = isset($instance['template']) ? $instance['template'] : ''; $autop = isset($instance['autop']) ? $instance['autop'] : ''; ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'podlove'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo $title; ?> " /> <label for="<?php echo $this->get_field_id('template'); ?> "><?php _e('Template', 'podlove'); ?> </label> <select class="widefat" id="<?php echo $this->get_field_id('template'); ?> " name="<?php echo $this->get_field_name('template'); ?> "> <?php foreach ($templates as $template) { ?> <option value="<?php echo $template->title; ?> " <?php echo $selected_template == $template->title ? 'selected=\\"selected\\"' : ''; ?> ><?php echo $template->title; ?> </option> <?php } ?> </select> <input class="widefat" type="checkbox" id="<?php echo $this->get_field_id('autop'); ?> " name="<?php echo $this->get_field_name('autop'); ?> " <?php echo $autop ? 'checked="checked"' : ''; ?> /> <label for="<?php echo $this->get_field_id('autop'); ?> "><?php _e('Autowrap blocks of text?', 'podlove'); ?> </label><br /> </p> <?php }
private function view_template() { echo sprintf(__('Episode Templates are an easy way to keep the same structure in all your episodes. You can use %sShortcodes%s as well as %sPublisher Template Tags%s to customize your episodes.<br> Please read the %sTemplating Guide%s to get started. ', 'podlove'), '<a href="http://docs.podlove.org/ref/shortcodes.html" target="_blank">', '</a>', '<a href="http://docs.podlove.org/reference/template-tags/" target="_blank">', '</a>', '<a href="http://docs.podlove.org/guides/understanding-templates/" target="_blank">', '</a>'); ?> <div id="template-editor"> <div class="navigation"> <ul> <?php foreach (Model\Template::all() as $template) { ?> <li> <a href="#" data-id="<?php echo $template->id; ?> "> <span class="filename"><?php echo $template->title; ?> </span> </a> </li> <?php } ?> </ul> <div class="add"> <a href="#">+ add new template</a> </div> </div> <div class="editor"> <div class="toolbar"> <div class="actions"> <a href="#" class="delete">delete</a> <a href="#" class="save button button-primary">Save</a> </div> <div class="title"> <input type="text"> </div> <div class="clear"></div> </div> <div class="editor-wrapper"> <div class="main" id="ace-editor"></div> <div id="fullscreen" class="fullscreen-on fullscreen-button"></div> </div> </div> <div class="clear"></div> </div> <h3><?php echo __('Insert templates to content automatically', 'podlove'); ?> </h3> <form method="post" action="options.php"> <?php settings_fields(Templates::$pagehook); $template_assignment = Model\TemplateAssignment::get_instance(); $form_attributes = array('context' => 'podlove_template_assignment', 'form' => false); \Podlove\Form\build_for($template_assignment, $form_attributes, function ($form) { $wrapper = new \Podlove\Form\Input\TableWrapper($form); $templates = array(0 => __('Don\'t insert automatically', 'podlove')); foreach (Model\Template::all_globally() as $template) { $templates[$template->title] = $template->title; } $wrapper->select('top', array('label' => __('Insert at top', 'podlove'), 'options' => $templates, 'please_choose' => false)); $wrapper->select('bottom', array('label' => __('Insert at bottom', 'podlove'), 'options' => $templates, 'please_choose' => false)); }); ?> </form> <?php }