/**
  * Hook the form process.
  *
  * @return void
  * @author Jimmy K. <*****@*****.**>
  */
 public function form($instance)
 {
     $instance = wp_parse_args((array) $instance, $this->fields);
     // TITLE
     echo OMS_SidebarWidget::output_text_field($instance, array('name' => 'title', 'label' => 'Title'));
     // THUMBNAIL IMAGE
     echo OMS_SidebarWidget::output_media_select_field($instance, array('name' => 'thumbnail_image', 'button_name' => 'thumbnail_image_button', 'button_class' => 'thumbnail_image_button', 'label' => 'Thumbnail Image'));
     // FULL IMAGE
     echo OMS_SidebarWidget::output_media_select_field($instance, array('name' => 'full_image', 'button_name' => 'full_image_button', 'button_class' => 'full_image_button', 'label' => 'Full Image'));
     // CAPTION
     echo OMS_SidebarWidget::output_textarea($instance, array('name' => 'caption', 'label' => 'Caption', 'rows' => 5));
 }
 /**
  * Hook the form process.
  *
  * @return void
  * @author Jimmy K. <*****@*****.**>
  */
 public function form($instance)
 {
     $instance = wp_parse_args((array) $instance, $this->fields);
     // TITLE
     echo OMS_SidebarWidget::output_text_field($instance, array('name' => 'title', 'label' => 'Title'));
     // THUMBNAIL IMAGE
     echo OMS_SidebarWidget::output_media_select_field($instance, array('name' => 'thumbnail_image', 'button_name' => 'thumbnail_image_button', 'button_class' => 'thumbnail_image_button', 'label' => 'Thumbnail Image'));
     // VIDEO URL
     echo OMS_SidebarWidget::output_text_field($instance, array('name' => 'video_url', 'label' => 'YouTube/Vimeo URL'));
     // CAPTION
     echo OMS_SidebarWidget::output_textarea($instance, array('name' => 'caption', 'label' => 'Caption', 'rows' => 5));
     // LENGTH
     echo OMS_SidebarWidget::output_text_field($instance, array('name' => 'length', 'label' => 'Length', 'help_text' => 'The length of this video in HH:MM:SS format.'));
 }
 /**
  * Hook the form process.
  *
  * @return void
  * @author Jimmy K. <*****@*****.**>
  */
 public function form($instance)
 {
     // Generate a unique id for this form.
     $unique_id = rand(0, 9999);
     // Get the instance.
     $instance = wp_parse_args((array) $instance, $this->fields);
     echo '
             <!-- oms-sw-map-form-container -->
             <div id="oms-sw-map-form-' . $unique_id . '" class="oms-sw-map-form-container">
         ';
     // JSON
     echo OMS_SidebarWidget::output_textarea($instance, array('name' => 'json', 'label' => 'JSON'));
     // TITLE
     echo OMS_SidebarWidget::output_text_field($instance, array('name' => 'title', 'label' => 'Title'));
     // MARKER IMAGE
     echo OMS_SidebarWidget::output_media_select_field($instance, array('name' => 'marker_image', 'button_name' => 'marker_image_button', 'button_class' => 'marker_image_button', 'label' => 'Marker Image', 'help_text' => 'Optional. If a custom marker isn\'t specified then the default one will be used.'));
     echo '
             <!-- repeatableContainer -->
             <div id="oms-sw-map-repeatable-container-' . $unique_id . '" class="repeatableContainer oms-sw-map-repeatable-container">
         ';
     if (!empty($instance['json'])) {
         // Parse the JSON object.
         $json = json_decode($instance['json']);
     } else {
         // Create an empty JSON object.
         $json = array(array(name => '', address_1 => '', address_2 => '', city => '', state => '', zip => '', country => '', lat => '', lng => '', email => '', phone => '', fax => ''));
     }
     // Hold the index.
     $i = 0;
     foreach ($json as $v) {
         echo '
                 <fieldset class="repeatable ' . ($i++ == 0 ? 'original' : '') . '">
                     <legend>Location</legend>
             ';
         // NAME
         echo '
                 <p class="name">
                     <label>Name:</label>
                     <input type="text" name="name" class="widefat name" value="' . $v->name . '" />
                 </p>
             ';
         // ADDRESS 1
         echo '
                 <p class="address_1">
                     <label>Address 1:</label>
                     <input type="text" name="address_1" class="widefat address_1" value="' . $v->address_1 . '" />
                 </p>
             ';
         // ADDRESS 2
         echo '
                 <p class="address_2">
                     <label>Address 2:</label>
                     <input type="text" name="address_2" class="widefat address_2" value="' . $v->address_2 . '" />
                 </p>
             ';
         // CITY
         echo '
                 <p class="city">
                     <label>City:</label>
                     <input type="text" name="city" class="widefat city" value="' . $v->city . '" />
                 </p>
             ';
         // STATE
         echo '
                 <p class="state">
                     <label>State:</label>
                     <input type="text" name="state" class="widefat state" value="' . $v->state . '" />
                 </p>
             ';
         // ZIP
         echo '
                 <p class="zip_code">
                     <label>Zip Code:</label>
                     <input type="text" name="zip_code" class="widefat zip_code" value="' . $v->zip_code . '" />
                 </p>
             ';
         // COUNTRY
         echo '
                 <p class="country">
                     <label>Country:</label>
                     <input type="text" name="country" class="widefat country" value="' . $v->country . '" />
                 </p>
             ';
         // LATITUDE
         echo '
                 <p class="lat">
                     <label>Latitude:</label>
                     <input type="text" name="lat" class="widefat lat" value="' . $v->lat . '" />
                     <div class="help">Leave blank to automatically geocode.</div>
                 </p>
             ';
         // LONGITUDE
         echo '
                 <p class="lng">
                     <label>Longitude:</label>
                     <input type="text" name="lng" class="widefat lng" value="' . $v->lng . '" />
                     <div class="help">Leave blank to automatically geocode.</div>
                 </p>
             ';
         // EMAIL
         echo '
                 <p class="email">
                     <label>Email:</label>
                     <input type="text" name="email" class="widefat email" value="' . $v->email . '" />
                 </p>
             ';
         // PHONE
         echo '
                 <p class="phone">
                     <label>Phone:</label>
                     <input type="text" name="phone" class="widefat phone" value="' . $v->phone . '" />
                 </p>
             ';
         // FAX
         echo '
                 <p class="fax">
                     <label>Fax:</label>
                     <input type="text" name="fax" class="widefat fax" value="' . $v->fax . '" />
                 </p>
             ';
         echo '
                     <input type="button" value="Remove Location" class="oms-sw-map-remove-location widefat button button-primary" onclick="oms_sw_map_remove_fieldset(this, ' . $unique_id . ');" />
                 </fieldset>
             ';
     }
     echo '
                 </div><!-- /repeatableContainer -->
                 <input type="button" value="+ Add Location" class="oms-sw-map-add-location widefat button" onclick="oms_sw_map_add_fieldset(this, ' . $unique_id . ');" />
             </div><!-- /oms-sw-map-form-container -->
         ';
 }