Permalink
Browse files

Remove unused properties and methods.

  • Loading branch information...
1 parent 4e68d05 commit bbe801cfe43f8b2ad6f97342f14b1fe79c80ae17 @ADmad ADmad committed Feb 22, 2014
Showing with 0 additions and 177 deletions.
  1. +0 −177 src/View/Helper/FormHelper.php
@@ -94,13 +94,6 @@ class FormHelper extends Helper {
public $requestType = null;
/**
- * The default model being used for the current form.
- *
- * @var string
- */
- public $defaultModel = null;
-
-/**
* Persistent default options used by input(). Set by FormHelper::create().
*
* @var array
@@ -118,30 +111,6 @@ class FormHelper extends Helper {
protected $_unlockedFields = array();
/**
- * Holds the model references already loaded by this helper
- * product of trying to inspect them out of field names
- *
- * @var array
- */
- protected $_models = array();
-
-/**
- * Holds all the validation errors for models loaded and inspected
- * it can also be set manually to be able to display custom error messages
- * in the any of the input fields generated by this helper
- *
- * @var array
- */
- public $validationErrors = array();
-
-/**
- * Holds already used DOM ID suffixes to avoid collisions with multiple form field elements.
- *
- * @var array
- */
- protected $_domIdSuffixes = array();
-
-/**
* Registry for input widgets.
*
* @var \Cake\View\Widget\InputRegistry
@@ -1870,34 +1839,6 @@ public function multiCheckbox($fieldName, $options, $attributes = []) {
}
/**
- * Generates a valid DOM ID suffix from a string.
- * Also avoids collisions when multiple values are coverted to the same suffix by
- * appending a numeric value.
- *
- * For pre-HTML5 IDs only characters like a-z 0-9 - _ are valid. HTML5 doesn't have that
- * limitation, but to avoid layout issues it still filters out some sensitive chars.
- *
- * @param string $value The value that should be transferred into a DOM ID suffix.
- * @param string $type Doctype to use. Defaults to html4.
- * @return string DOM ID
- */
- public function domIdSuffix($value, $type = 'html4') {
- if ($type === 'html5') {
- $value = str_replace(array('@', '<', '>', ' ', '"', '\''), '_', $value);
- } else {
- $value = Inflector::camelize(Inflector::slug($value));
- }
- $value = Inflector::camelize($value);
- $count = 1;
- $suffix = $value;
- while (in_array($suffix, $this->_domIdSuffixes)) {
- $suffix = $value . $count++;
- }
- $this->_domIdSuffixes[] = $suffix;
- return $suffix;
- }
-
-/**
* Returns a SELECT element for days.
*
* ### Attributes:
@@ -2420,124 +2361,6 @@ protected function _name($options = array(), $field = null, $key = 'name') {
}
/**
- * Returns an array of formatted OPTION/OPTGROUP elements
- *
- * @param array $elements
- * @param array $parents
- * @param boolean $showParents
- * @param array $attributes
- * @return array
- */
- protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
- $select = array();
- $attributes = array_merge(
- array('escape' => true, 'style' => null, 'value' => null, 'class' => null),
- $attributes
- );
- $selectedIsEmpty = ($attributes['value'] === '' || $attributes['value'] === null);
- $selectedIsArray = is_array($attributes['value']);
-
- $this->_domIdSuffixes = array();
- foreach ($elements as $name => $title) {
- $htmlOptions = array();
- if (is_array($title) && (!isset($title['name']) || !isset($title['value']))) {
- if (!empty($name)) {
- if ($attributes['style'] === 'checkbox') {
- $select[] = $this->Html->useTag('fieldsetend');
- } else {
- $select[] = $this->Html->useTag('optiongroupend');
- }
- $parents[] = $name;
- }
- $select = array_merge($select, $this->_selectOptions(
- $title, $parents, $showParents, $attributes
- ));
-
- if (!empty($name)) {
- $name = $attributes['escape'] ? h($name) : $name;
- if ($attributes['style'] === 'checkbox') {
- $select[] = $this->Html->useTag('fieldsetstart', $name);
- } else {
- $select[] = $this->Html->useTag('optiongroup', $name, '');
- }
- }
- $name = null;
- } elseif (is_array($title)) {
- $htmlOptions = $title;
- $name = $title['value'];
- $title = $title['name'];
- unset($htmlOptions['name'], $htmlOptions['value']);
- }
-
- if ($name !== null) {
- $isNumeric = is_numeric($name);
- if (
- (!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
- ($selectedIsArray && in_array((string)$name, $attributes['value'], !$isNumeric))
- ) {
- if ($attributes['style'] === 'checkbox') {
- $htmlOptions['checked'] = true;
- } else {
- $htmlOptions['selected'] = 'selected';
- }
- }
-
- if ($showParents || (!in_array($title, $parents))) {
- $title = ($attributes['escape']) ? h($title) : $title;
-
- $hasDisabled = !empty($attributes['disabled']);
- if ($hasDisabled) {
- $disabledIsArray = is_array($attributes['disabled']);
- if ($disabledIsArray) {
- $disabledIsNumeric = is_numeric($name);
- }
- }
- if (
- $hasDisabled &&
- $disabledIsArray &&
- in_array((string)$name, $attributes['disabled'], !$disabledIsNumeric)
- ) {
- $htmlOptions['disabled'] = 'disabled';
- }
- if ($hasDisabled && !$disabledIsArray && $attributes['style'] === 'checkbox') {
- $htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
- }
-
- if ($attributes['style'] === 'checkbox') {
- $htmlOptions['value'] = $name;
-
- $tagName = $attributes['id'] . $this->domIdSuffix($name);
- $htmlOptions['id'] = $tagName;
- $label = array('for' => $tagName);
-
- if (isset($htmlOptions['checked']) && $htmlOptions['checked'] === true) {
- $label['class'] = 'selected';
- }
-
- $name = $attributes['name'];
-
- if (empty($attributes['class'])) {
- $attributes['class'] = 'checkbox';
- } elseif ($attributes['class'] === 'form-error') {
- $attributes['class'] = 'checkbox ' . $attributes['class'];
- }
- $label = $this->label(null, $title, $label);
- $item = $this->Html->useTag('checkboxmultiple', $name, $htmlOptions);
- $select[] = $this->Html->div($attributes['class'], $item . $label);
- } else {
- if ($attributes['escape']) {
- $name = h($name);
- }
- $select[] = $this->Html->useTag('selectoption', $name, $htmlOptions, $title);
- }
- }
- }
- }
-
- return array_reverse($select, true);
- }
-
-/**
* Generates option lists for common <select /> menus
*
* @param string $name

0 comments on commit bbe801c

Please sign in to comment.