public function get_markup()
 {
     $element_id = $this->_get_property('element_id');
     $element_id = $element_id ? "id='{$element_id}'" : '';
     $widget_name = $this->_get_property('widget');
     $widget = new Upfront_Uwidget($widget_name);
     $fields = $widget->get_widget_admin_fields();
     // Treat the legacy widget setup
     if (empty($fields) && !(defined('DOING_AJAX') && DOING_AJAX)) {
         $fields_tmp = $this->_get_property('widget_specific_fields');
         if (!empty($fields_tmp)) {
             foreach ($fields_tmp as $field) {
                 if (empty($field['name'])) {
                     continue;
                 }
                 $fields[] = array('name' => $field['name']);
             }
         }
     }
     // We should be good here now
     $instance = array();
     foreach ($fields as $field) {
         $name = !empty($field['name']) ? $field['name'] : false;
         if (empty($name)) {
             continue;
         }
         $instance[$name] = $this->_get_property($name);
     }
     return "<div class=' upfront-widget' {$element_id}>" . $widget->get_widget_markup($instance) . "</div>";
 }
 public function load_admin_form()
 {
     $data = json_decode(stripslashes($_POST['data']), true);
     $widget = new Upfront_Uwidget($data['widget']);
     $this->_out(new Upfront_JsonResponse_Success($widget->get_widget_admin_fields($data['widget'])));
 }