skipv1_0_0Autocomplete

The Facebook Fanpage Import skip v1 0 Autocomplete class.

Defined (1)

The class is defined in the following location(s).

/includes/skip/elements/forms/autocomplete.php  
  1. class Autocomplete extends Textfield{ 
  2. /** 
  3. * Constructor 
  4. * @since 1.0 
  5. * @param string $name Name of Autocomplete field. 
  6. * @param array/string $args List of Arguments. 
  7. */ 
  8. function __construct( $name, $label = FALSE, $args = array() ) { 
  9. parent::__construct( $name, $label, $args ); 
  10.  
  11. /** 
  12. * Rendering Field 
  13. * @since 1.0 
  14. * @return string $html Returns The HTML Code. 
  15. */  
  16. public function render() { 
  17. global $skip_javascripts; 
  18.  
  19. $autocomplete_values = array(); 
  20. foreach( $this->elements AS $key => $value ) 
  21. array_push( $autocomplete_values, '"' . $value . '"' ); 
  22.  
  23. $values = implode( ', ', $autocomplete_values ); 
  24.  
  25. // If there are any autocomplete values show JS 
  26. if( count( $autocomplete_values ) > 0 ): 
  27. $skip_javascripts[] = '$("#' . $this->params[ 'id' ] . '").autocomplete({ source: [' . $values . '] });'; 
  28. endif; 
  29.  
  30. return parent::render();