Example #1
0
 /**
  * Creates a image link.
  *
  * @param   string   file name
  * @param   array    default attributes
  * @return  string
  */
 public static function image($file, array $attributes = NULL)
 {
     if (strpos($file, '://') === FALSE) {
         // Add the base URL
         $file = URL::base(FALSE) . $file;
     }
     // Add the image link
     $attributes['src'] = $file;
     return '<img' . HTML::attributes($attributes) . ' />';
 }
Example #2
0
 /**
  * Creates a form label.
  * 
  * @param   string  target input
  * @param   string  label text
  * @param   array   html attributes
  * @return  string
  */
 public static function label($input, $text = NULL, array $attributes = NULL)
 {
     if ($text === NULL) {
         // Use the input name as the text
         $text = ucwords(str_replace('_', ' ', $input));
     }
     // Set the label target
     $attributes['for'] = $input;
     return '<label' . HTML::attributes($attributes) . '>' . $text . '</label>';
 }