/** * Creates Select Options for widget * * @TODO Add Labels * * @since 0.2.0 * @access public * * @param $args Array */ public function ads_dropdown($args) { // Why is it so nested? $args = $args[0]; // Field values $id = $this->options_str . '[' . $args['id'] . ']'; $title = $args['title']; $value = !isset($this->values[$args['id']]) ? '' : $this->values[$args['id']]; ?> <div> <select id="<?php _e($id, 'dfp-ads'); ?> " name="<?php _e($id, 'dfp-ads'); ?> "> <?php dfp_ad_select_options($value); ?> </select> <?php if (isset($args['description'])) { ?> <p><em><?php _e($args['description'], 'dfp-ads'); ?> </em></p> <?php } ?> </div> <?php }
/** * Generates the administration form for the widget. * * @since 0.0.1 * @access public * * @param array instance The array of keys and values for the widget. * * @return mixed */ public function form($instance) { $id = $this->get_field_id('position_title') !== null ? $this->get_field_id('position_title') : ''; $name = $this->get_field_name('position_title') !== null ? $this->get_field_name('position_title') : ''; $value = isset($instance['position_title']) ? $instance['position_title'] : ''; ?> <h4><label for="<?php _e($id); ?> "><?php _e('Ad Position', 'dfp-ads'); ?> </label></h4> <p> <select class="widefat" name="<?php _e($name); ?> " id="<?php _e($id); ?> "> <?php dfp_ad_select_options($value); ?> </select> </p> <?php }