Esempio n. 1
0
/**
 * Gets the input field name for the current tag
 *
 * @param array $options
 * @param string $field
 * @param string $key
 * @return array
 */
	protected function _name($options = array(), $field = null, $key = 'name') {
		if ($this->requestType === 'get') {
			if ($options === null) {
				$options = array();
			} elseif (is_string($options)) {
				$field = $options;
				$options = 0;
			}

			if (!empty($field)) {
				$this->setEntity($field);
			}

			if (is_array($options) && isset($options[$key])) {
				return $options;
			}

			$entity = $this->entity();
			$model = $this->model();
			$name = $model === $entity[0] && isset($entity[1]) ? $entity[1] : $entity[0];
			$last = $entity[count($entity) - 1];
			if (in_array($last, $this->_fieldSuffixes)) {
				$name .= '[' . $last . ']';
			}

			if (is_array($options)) {
				$options[$key] = $name;
				return $options;
			} else {
				return $name;
			}
		}
		return parent::_name($options, $field, $key);
	}
Esempio n. 2
0
 /**
  * Gets the input field name for the current tag
  *
  * @param array $options
  * @param string $key
  * @return array
  * @access protected
  */
 function _name($options = array(), $field = null, $key = 'name')
 {
     if ($this->requestType == 'get') {
         if ($options === null) {
             $options = array();
         } elseif (is_string($options)) {
             $field = $options;
             $options = 0;
         }
         if (!empty($field)) {
             $this->setEntity($field);
         }
         if (is_array($options) && isset($options[$key])) {
             return $options;
         }
         $view = ClassRegistry::getObject('view');
         $name = $view->field;
         if (!empty($view->fieldSuffix)) {
             $name .= '[' . $view->fieldSuffix . ']';
         }
         if (is_array($options)) {
             $options[$key] = $name;
             return $options;
         } else {
             return $name;
         }
     }
     return parent::_name($options, $field, $key);
 }
Esempio n. 3
0
 /**
  * Gets the input field name for the current tag
  *
  * @param array $options
  * @param string $key
  * @return array
  */
 protected function _name($options = array(), $field = null, $key = 'name')
 {
     if ($this->requestType == 'get') {
         if ($options === null) {
             $options = array();
         } elseif (is_string($options)) {
             $field = $options;
             $options = 0;
         }
         if (!empty($field)) {
             $this->setEntity($field);
         }
         if (is_array($options) && isset($options[$key])) {
             return $options;
         }
         $name = !empty($this->_View->field) ? $this->_View->field : $this->_View->model;
         if (!empty($this->_View->fieldSuffix)) {
             $name .= '[' . $this->_View->fieldSuffix . ']';
         }
         if (is_array($options)) {
             $options[$key] = $name;
             return $options;
         } else {
             return $name;
         }
     }
     return parent::_name($options, $field, $key);
 }
Esempio n. 4
0
 /**
  * Gets the input field name for the current tag
  *
  * @param array $options
  * @param string $key
  * @return array
  * @access protected
  */
 function _name($options = array(), $field = null, $key = 'name')
 {
     if ($this->requestType == 'get') {
         if ($options === null) {
             $options = array();
         } elseif (is_string($options)) {
             $field = $options;
             $options = 0;
         }
         if (!empty($field)) {
             $this->setEntity($field);
         }
         if (is_array($options) && isset($options[$key])) {
             return $options;
         }
         $name = $this->field();
         if (is_array($options)) {
             $options[$key] = $name;
             return $options;
         } else {
             return $name;
         }
     }
     return parent::_name($options, $field, $key);
 }