first commit
This commit is contained in:
39
application/helpers/MY_form.php
Normal file
39
application/helpers/MY_form.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user