echo $text; ?> </option> <?php } ?> </select> </dd> <dt>Text</dt> <dd> <input type="text" name="<?php printf($name, 'text_up'); ?> " placeholder="Up" value="<?php echo $options['text_up']; ?> " autocomplete="off"></input> <br> <input type="text" name="<?php printf($name, 'text_down'); ?> " placeholder="Down" value="<?php echo $options['text_down']; ?> " autocomplete="off"></input> </dd> <?php } } Evaluate_Metrics::register_type(new Evaluate_Metric_Two_Way());
<input name="<?php printf($name, 'weight'); ?> " type="number" placeholder="Weight (1.0)" value="<?php echo $field['weight']; ?> "></input> <?php foreach ($metric_types as $slug => $metric_type) { ?> <dl class="field-options-<?php echo $slug; ?> field-options"<?php echo $slug == $field['type'] ? '' : ' style="display: none;"'; ?> > <?php $options_name = sprintf($name, 'options') . '[%s]'; $metric_type->render_options($field['options'], $options_name); ?> </dl> <?php } ?> </li> <?php } } Evaluate_Metrics::register_type(new Evaluate_Metric_Rubric());
echo $slug; ?> " <?php selected($slug, $options['icon']); ?> > <?php echo $text; ?> </option> <?php } ?> </select> </dd> <dt>Maximum Rating</dt> <dd> <input type="number" min="2" name="<?php printf($name, 'max'); ?> " value="<?php echo $options['max']; ?> "></input> </dd> <?php // TODO: Add minimum rating } } Evaluate_Metrics::register_type(new Evaluate_Metric_Range());
} // ===== ADMIN FACING CODE ==== // public function render_options($options, $name = 'options[%s]') { $options = shortcode_atts(array('question' => "", 'answers' => ""), $options); ?> <dt>Question</dt> <dd><input type="text" name="<?php printf($name, 'question'); ?> " value="<?php echo $options['question']; ?> " autocomplete="off"></input></dd> <dt>Answers</dt> <dd> <textarea name="<?php printf($name, 'answers'); ?> "><?php echo $options['answers']; ?> </textarea> <br> <small>One answer per line</small> </dd> <?php } } Evaluate_Metrics::register_type(new Evaluate_Metric_Poll());