|
|
|
@ -415,18 +415,18 @@ class Html
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a button tag. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param string $content the content enclosed within the button tag. It will NOT be HTML-encoded. |
|
|
|
|
* Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, |
|
|
|
|
* you should consider [[encode()]] it to prevent XSS attacks. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param array $options the tag options in terms of name-value pairs. These will be rendered as |
|
|
|
|
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. |
|
|
|
|
* If a value is null, the corresponding attribute will not be rendered. |
|
|
|
|
* If the options does not contain "type", a "type" attribute with value "button" will be rendered. |
|
|
|
|
* @return string the generated button tag |
|
|
|
|
*/ |
|
|
|
|
public static function button($name = null, $value = null, $content = 'Button', $options = array()) |
|
|
|
|
public static function button($content = 'Button', $name = null, $value = null, $options = array()) |
|
|
|
|
{ |
|
|
|
|
$options['name'] = $name; |
|
|
|
|
$options['value'] = $value; |
|
|
|
@ -438,38 +438,38 @@ class Html
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a submit button tag. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param string $content the content enclosed within the button tag. It will NOT be HTML-encoded. |
|
|
|
|
* Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, |
|
|
|
|
* you should consider [[encode()]] it to prevent XSS attacks. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param array $options the tag options in terms of name-value pairs. These will be rendered as |
|
|
|
|
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. |
|
|
|
|
* If a value is null, the corresponding attribute will not be rendered. |
|
|
|
|
* @return string the generated submit button tag |
|
|
|
|
*/ |
|
|
|
|
public static function submitButton($name = null, $value = null, $content = 'Submit', $options = array()) |
|
|
|
|
public static function submitButton($content = 'Submit', $name = null, $value = null, $options = array()) |
|
|
|
|
{ |
|
|
|
|
$options['type'] = 'submit'; |
|
|
|
|
return static::button($name, $value, $content, $options); |
|
|
|
|
return static::button($content, $name, $value, $options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generates a reset button tag. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param string $content the content enclosed within the button tag. It will NOT be HTML-encoded. |
|
|
|
|
* Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, |
|
|
|
|
* you should consider [[encode()]] it to prevent XSS attacks. |
|
|
|
|
* @param string $name the name attribute. If it is null, the name attribute will not be generated. |
|
|
|
|
* @param string $value the value attribute. If it is null, the value attribute will not be generated. |
|
|
|
|
* @param array $options the tag options in terms of name-value pairs. These will be rendered as |
|
|
|
|
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. |
|
|
|
|
* If a value is null, the corresponding attribute will not be rendered. |
|
|
|
|
* @return string the generated reset button tag |
|
|
|
|
*/ |
|
|
|
|
public static function resetButton($name = null, $value = null, $content = 'Reset', $options = array()) |
|
|
|
|
public static function resetButton($content = 'Reset', $name = null, $value = null, $options = array()) |
|
|
|
|
{ |
|
|
|
|
$options['type'] = 'reset'; |
|
|
|
|
return static::button($name, $value, $content, $options); |
|
|
|
|
return static::button($content, $name, $value, $options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|