Widget View File selection now a SELECT field develop
authorLaury GvR <laury@gaslightmedia.com>
Thu, 24 Oct 2019 14:24:10 +0000 (10:24 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 24 Oct 2019 14:24:10 +0000 (10:24 -0400)
to avoid having to manually put in one among a number of potential
values. The options are hardcoded, time can be spent later on
retrieving them as intelligently as the rest of the view_file
field attributes are.

models/Glmclientinfo_Widget.php

index 686fbc1..093ba11 100644 (file)
@@ -72,12 +72,14 @@ class Glmclientinfo_Widget
         <?php esc_attr_e( 'View File:', 'text_domain' ); ?>
         </label> 
         
-        <input 
+        <select
             class="widefat" 
             id="<?php echo esc_attr( $this->get_field_id( 'view_file' ) ); ?>" 
-            name="<?php echo esc_attr( $this->get_field_name( 'view_file' ) ); ?>" 
-            type="text" 
-            value="<?php echo esc_attr( $view_file ); ?>">
+            name="<?php echo esc_attr( $this->get_field_name( 'view_file' ) ); ?>">
+                <option value="footer" <?php if ( esc_attr( $view_file ) == "footer" ) { echo "selected";} ?>>Footer</option>
+                <option value="social-media" <?php if ( esc_attr( $view_file ) == "social-media" ) { echo "selected";} ?>>Social Media</option>
+        </select>
+
         </p>
         <?php
     }