parent::__construct(
'GlmClientInfo_Widget',
__('Client Info Widget', 'text_domain'),
- array('description' => __('A Gaslight Widget', 'text_domain'))
+ array(
+ 'description' => __('A Gaslight Widget', 'text_domain'),
+ )
);
}
public function widget($args, $instance)
{
$path = plugin_dir_path(__FILE__);
- include $path . '../views/vCard.php';
+ include $path . "../views/".$instance['view_file'] . ".php";
}
+ public function form( $instance ) {
+ $view_file = ! empty( $instance['view_file'] ) ? $instance['view_file'] : esc_html__( 'footer', 'text_domain' );
+ ?>
+ <p>
+ <label for="<?php echo esc_attr( $this->get_field_id( 'view_file' ) ); ?>">
+ <?php esc_attr_e( 'View File:', 'text_domain' ); ?>
+ </label>
+
+ <input
+ 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 ); ?>">
+ </p>
+ <?php
+ }
+
+ // save options
+ public function update( $new_instance, $old_instance ) {
+ $instance = array();
+ $instance['view_file'] = ( ! empty( $new_instance['view_file'] ) ) ? strip_tags( $new_instance['view_file'] ) : '';
+
+ return $instance;
+ }
/**
* Return the quicksite option for the given key
*
--- /dev/null
+<div class="glm-footer-client-info">
+ <?php foreach( get_option('glmclientinfo_settings') as $setting => $value){ ?>
+ <div class="glm-client-info-field glm-client-info-<?php echo $setting; ?>">
+ <?php if( $value !== '') { ?>
+ <div class="glm-client-info-name" ><?php echo $setting; ?>:</div>
+ <?php if( $setting === "phone" || $setting === "tollfree"){ ?>
+ <a href="tel:<?php echo str_replace(array('.', ',','-'), '' , $value); ?>"><?php echo $value; ?></a>
+ <?php } else { ?>
+ <div class="glm-client-info-value"><?php echo $value;?></div>
+ <?php } ?>
+ <?php } ?>
+ </div>
+ <?php } ?>
+</div>
\ No newline at end of file