Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement the InputInterface where it is needed.

This interface lets the framework have some certainty that userland
extensions will be compatible.
  • Loading branch information...
commit 08920aa043c1827088f7d76b6f75a87b45697368 1 parent d264a82
@markstory markstory authored
View
6 src/View/Input/Checkbox.php
@@ -14,10 +14,12 @@
*/
namespace Cake\View\Input;
+use Cake\View\Input\InputInterface;
+
/**
* Input widget for creating checkbox widgets.
*/
-class Checkbox {
+class Checkbox implements InputInterface {
/**
* Template instance.
@@ -51,7 +53,7 @@ public function __construct($templates) {
* @param array $data The data to create a checkbox with.
* @return string Generated HTML string.
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'name' => '',
'value' => 1,
View
6 src/View/Input/Label.php
@@ -14,13 +14,15 @@
*/
namespace Cake\View\Input;
+use Cake\View\Input\InputInterface;
+
/**
* Form 'widget' for creating labels.
*
* Generally this element is used by other widgets,
* and FormHelper itself.
*/
-class Label {
+class Label implements InputInterface {
/**
* Templates
@@ -57,7 +59,7 @@ public function __construct($templates) {
* @param array $data
* @return string
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'text' => '',
'input' => '',
View
5 src/View/Input/MultiCheckbox.php
@@ -15,12 +15,13 @@
namespace Cake\View\Input;
use Cake\Utility\Inflector;
+use Cake\View\Input\InputInterface;
/**
* Input widget class for generating multiple checkboxes.
*
*/
-class MultiCheckbox {
+class MultiCheckbox implements InputInterface {
/**
* Template instance to use.
@@ -95,7 +96,7 @@ public function __construct($templates, $label) {
* @param array $data
* @return string
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'name' => '',
'escape' => true,
View
5 src/View/Input/Radio.php
@@ -15,6 +15,7 @@
namespace Cake\View\Input;
use Cake\Utility\Inflector;
+use Cake\View\InputInterface;
use Traversable;
/**
@@ -23,7 +24,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
-class Radio {
+class Radio implements InputInterface {
/**
* Template instance.
@@ -72,7 +73,7 @@ public function __construct($templates, $label) {
* @param array $data The data to build radio buttons with.
* @return string
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'name' => '',
'options' => [],
View
5 src/View/Input/SelectBox.php
@@ -14,6 +14,7 @@
*/
namespace Cake\View\Input;
+use Cake\View\Input\InputInterface;
use Traversable;
/**
@@ -22,7 +23,7 @@
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
-class SelectBox {
+class SelectBox implements InputInterface {
/**
* Template instance.
@@ -113,7 +114,7 @@ public function __construct($templates) {
* @return string A generated select box.
* @throws \RuntimeException when the name attribute is empty.
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'name' => '',
'empty' => false,
View
6 src/View/Input/Text.php
@@ -14,6 +14,8 @@
*/
namespace Cake\View\Input;
+use Cake\View\Input\InputInterface;
+
/**
* Basic input class.
*
@@ -21,7 +23,7 @@
* input elements like hidden, text, email, tel and other
* types.
*/
-class Text {
+class Text implements InputInterface {
/**
* StringTemplate instance.
@@ -53,7 +55,7 @@ public function __construct($templates) {
* @param array $data The data to build an input with.
* @return string
*/
- public function render($data) {
+ public function render(array $data) {
$data += [
'name' => '',
'val' => null,
Please sign in to comment.
Something went wrong with that request. Please try again.