Skip to content

Commit

Permalink
Merge pull request #2758 from ADmad/3.0-widget
Browse files Browse the repository at this point in the history
3.0 widget
  • Loading branch information
lorenzo committed Feb 2, 2014
2 parents a72c47e + 0d0c41e commit db6a0e4
Show file tree
Hide file tree
Showing 23 changed files with 93 additions and 93 deletions.
6 changes: 3 additions & 3 deletions src/View/Input/Basic.php → src/View/Widget/Basic.php
Expand Up @@ -12,9 +12,9 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Basic input class.
Expand All @@ -23,7 +23,7 @@
* input elements like hidden, text, email, tel and other
* types.
*/
class Basic implements InputInterface {
class Basic implements WidgetInterface {

/**
* StringTemplate instance.
Expand Down
6 changes: 3 additions & 3 deletions src/View/Input/Button.php → src/View/Widget/Button.php
Expand Up @@ -12,9 +12,9 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Button input class
Expand All @@ -23,7 +23,7 @@
* If you need to make basic submit inputs with type=submit,
* use the Basic input widget.
*/
class Button implements InputInterface {
class Button implements WidgetInterface {

/**
* StringTemplate instance.
Expand Down
6 changes: 3 additions & 3 deletions src/View/Input/Checkbox.php → src/View/Widget/Checkbox.php
Expand Up @@ -12,14 +12,14 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Input widget for creating checkbox widgets.
*/
class Checkbox implements InputInterface {
class Checkbox implements WidgetInterface {

/**
* Template instance.
Expand Down
12 changes: 6 additions & 6 deletions src/View/Input/DateTime.php → src/View/Widget/DateTime.php
Expand Up @@ -12,24 +12,24 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\Utility\Time;
use Cake\View\Input\InputInterface;
use Cake\View\StringTemplate;
use Cake\View\Widget\WidgetInterface;

/**
* Input widget class for generating a date time input widget.
*
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class DateTime implements InputInterface {
class DateTime implements WidgetInterface {

/**
* Select box widget.
*
* @var Cake\View\Input\Select
* @var Cake\View\Widget\Select
*/
protected $_select;

Expand Down Expand Up @@ -59,7 +59,7 @@ class DateTime implements InputInterface {
* Constructor
*
* @param Cake\View\StringTemplate $templates
* @param Cake\View\Input\SelectBox $selectBox
* @param Cake\View\Widget\SelectBox $selectBox
*/
public function __construct($templates, $selectBox) {
$this->_select = $selectBox;
Expand Down Expand Up @@ -98,7 +98,7 @@ public function __construct($templates, $selectBox) {
*
* The `hour` option allows you to set the following options:
*
* - `format` option which accepts 12 or 24, allowing
* - `format` option which accepts 12 or 24, allowing
* you to indicate which hour format you want.
* - `start` The hour to start the options at.
* - `end` The hour to stop the options at.
Expand Down
6 changes: 3 additions & 3 deletions src/View/Input/File.php → src/View/Widget/File.php
Expand Up @@ -12,17 +12,17 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Input widget class for generating a file upload control.
*
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class File implements InputInterface {
class File implements WidgetInterface {

/**
* Constructor
Expand Down
Expand Up @@ -12,11 +12,11 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\Core\App;
use Cake\View\Input\InputInterface;
use Cake\View\StringTemplate;
use Cake\View\Widget\WidgetInterface;
use \ReflectionClass;

/**
Expand All @@ -40,16 +40,16 @@ class InputRegistry {
* @var array
*/
protected $_widgets = [
'button' => ['Cake\View\Input\Button'],
'checkbox' => ['Cake\View\Input\Checkbox'],
'file' => ['Cake\View\Input\File'],
'label' => ['Cake\View\Input\Label'],
'multicheckbox' => ['Cake\View\Input\MultiCheckbox', 'label'],
'radio' => ['Cake\View\Input\Radio', 'label'],
'select' => ['Cake\View\Input\SelectBox'],
'textarea' => ['Cake\View\Input\Textarea'],
'datetime' => ['Cake\View\Input\DateTime', 'select'],
'_default' => ['Cake\View\Input\Basic'],
'button' => ['Cake\View\Widget\Button'],
'checkbox' => ['Cake\View\Widget\Checkbox'],
'file' => ['Cake\View\Widget\File'],
'label' => ['Cake\View\Widget\Label'],
'multicheckbox' => ['Cake\View\Widget\MultiCheckbox', 'label'],
'radio' => ['Cake\View\Widget\Radio', 'label'],
'select' => ['Cake\View\Widget\SelectBox'],
'textarea' => ['Cake\View\Widget\Textarea'],
'datetime' => ['Cake\View\Widget\DateTime', 'select'],
'_default' => ['Cake\View\Widget\Basic'],
];

/**
Expand Down Expand Up @@ -104,7 +104,7 @@ public function add(array $widgets) {
* the `_default` widget is undefined.
*
* @param string $name The widget name to get.
* @return mixed InputInterface widget interface class.
* @return mixed WidgetInterface widget interface class.
* @throws \RuntimeException when widget is undefined.
*/
public function get($name) {
Expand All @@ -131,9 +131,9 @@ public function clear() {
* Resolves a widget spec into an instance.
*
* @param mixed $widget The widget to get
* @return InputInterface
* @return WidgetInterface
* @throws \RuntimeException when class cannot be loaded or does not
* implement InputInterface.
* implement WidgetInterface.
*/
protected function _resolveWidget($widget) {
if (is_object($widget)) {
Expand All @@ -154,8 +154,8 @@ protected function _resolveWidget($widget) {
} else {
$instance = new $className($this->_templates);
}
if (!($instance instanceof InputInterface)) {
throw new \RuntimeException(sprintf('"%s" does not implement the InputInterface', $className));
if (!($instance instanceof WidgetInterface)) {
throw new \RuntimeException(sprintf('"%s" does not implement the WidgetInterface', $className));
}
return $instance;
}
Expand Down
6 changes: 3 additions & 3 deletions src/View/Input/Label.php → src/View/Widget/Label.php
Expand Up @@ -12,17 +12,17 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Form 'widget' for creating labels.
*
* Generally this element is used by other widgets,
* and FormHelper itself.
*/
class Label implements InputInterface {
class Label implements WidgetInterface {

/**
* Templates
Expand Down
Expand Up @@ -12,16 +12,16 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\Utility\Inflector;
use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Input widget class for generating multiple checkboxes.
*
*/
class MultiCheckbox implements InputInterface {
class MultiCheckbox implements WidgetInterface {

/**
* Template instance to use.
Expand All @@ -33,7 +33,7 @@ class MultiCheckbox implements InputInterface {
/**
* Label widget instance.
*
* @var Cake\View\Input\Label
* @var Cake\View\Widget\Label
*/
protected $_label;

Expand All @@ -49,7 +49,7 @@ class MultiCheckbox implements InputInterface {
* variables.
*
* @param Cake\View\StringTemplate $templates
* @param Cake\View\Input\Label $label
* @param Cake\View\Widget\Label $label
*/
public function __construct($templates, $label) {
$this->_templates = $templates;
Expand Down
12 changes: 6 additions & 6 deletions src/View/Input/Radio.php → src/View/Widget/Radio.php
Expand Up @@ -12,10 +12,10 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\Utility\Inflector;
use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;
use Traversable;

/**
Expand All @@ -24,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 implements InputInterface {
class Radio implements WidgetInterface {

/**
* Template instance.
Expand All @@ -35,8 +35,8 @@ class Radio implements InputInterface {

/**
* Label instance.
*
* @var Cake\View\Input\Label
*
* @var Cake\View\Widget\Label
*/
protected $_label;

Expand All @@ -52,7 +52,7 @@ class Radio implements InputInterface {
* variables.
*
* @param Cake\View\StringTemplate $templates
* @param Cake\View\Input\Label $label
* @param Cake\View\Widget\Label $label
*/
public function __construct($templates, $label) {
$this->_templates = $templates;
Expand Down
Expand Up @@ -12,9 +12,9 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;
use Traversable;

/**
Expand All @@ -23,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 implements InputInterface {
class SelectBox implements WidgetInterface {

/**
* Template instance.
Expand Down
6 changes: 3 additions & 3 deletions src/View/Input/Textarea.php → src/View/Widget/Textarea.php
Expand Up @@ -12,17 +12,17 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

use Cake\View\Input\InputInterface;
use Cake\View\Widget\WidgetInterface;

/**
* Input widget class for generating a textarea control.
*
* This class is intended as an internal implementation detail
* of Cake\View\Helper\FormHelper and is not intended for direct use.
*/
class Textarea implements InputInterface {
class Textarea implements WidgetInterface {

/**
* Constructor
Expand Down
Expand Up @@ -12,12 +12,12 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\View\Input;
namespace Cake\View\Widget;

/**
* Interface for input widgets.
*/
interface InputInterface {
interface WidgetInterface {

/**
* Converts the $data into one or many HTML elements.
Expand Down
Expand Up @@ -12,11 +12,11 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\View\Input;
namespace Cake\Test\TestCase\View\Widget;

use Cake\TestSuite\TestCase;
use Cake\View\Input\Basic;
use Cake\View\StringTemplate;
use Cake\View\Widget\Basic;

/**
* Basic input test.
Expand Down
Expand Up @@ -12,11 +12,11 @@
* @since CakePHP(tm) v3.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
namespace Cake\Test\TestCase\View\Input;
namespace Cake\Test\TestCase\View\Widget;

use Cake\TestSuite\TestCase;
use Cake\View\Input\Button;
use Cake\View\StringTemplate;
use Cake\View\Widget\Button;

/**
* Basic input test.
Expand Down

0 comments on commit db6a0e4

Please sign in to comment.