39 lines
949 B
PHP
39 lines
949 B
PHP
<?php defined('SYSPATH') or die('No direct script access.');
|
|
|
|
class form extends form_Core {
|
|
|
|
/**
|
|
* Creates an HTML form image input tag.
|
|
*
|
|
* @param string|array input name or an array of HTML attributes
|
|
* @param string input value, when using a name
|
|
* @param string a string to be attached to the end of the attributes
|
|
* @return string
|
|
*/
|
|
public static function image($data = '', $src, $value = '', $extra = '', $index = FALSE)
|
|
{
|
|
if ( ! is_array($data))
|
|
{
|
|
$data = array('name' => $data);
|
|
}
|
|
|
|
if (empty($data['name']))
|
|
{
|
|
// Remove the name if it is empty
|
|
unset($data['name']);
|
|
}
|
|
|
|
if (strpos($src, '://') === FALSE)
|
|
{
|
|
// Make the src attribute into an absolute URL
|
|
$src = url::base($index).$src;
|
|
}
|
|
|
|
$data['type'] = 'image';
|
|
$data['src'] = $src;
|
|
$data['alt'] = $value;
|
|
|
|
return form::input($data, $value, $extra);
|
|
}
|
|
}
|
|
?>
|