input method

@param string $fieldName
@param array  $options
@return string
11623
public function input($fieldName, $options = [])
    {
        //** we need to make the input combine with <span class="input-group-addon">@</span>
        if (isset($options['icon'])) {
            $icon = $this->Html->icon($options['icon']);

            $between = '<div class="input-group">' . '<span class="input-group-addon">' . $icon . '</span>';

            $after = '</div>';
            $options = [
                'between' => $between,
                'after' => $after,
            ];
        }
        if (!isset($options['placeholder'])) {
            $options['placeholder'] = __(Inflector::humanize(Inflector::underscore($fieldName)));
        }
        return parent::input($fieldName, $options);
    }
1308527
public function file($fieldName, array $options = [])
    {
        $errorSuffix = null;
        $error       = $this->error($fieldName);
        $content     = parent::file($fieldName, $options);

        if ($this->getConfig('materializeCss', false) === false) {
            return $content;
        }

        $options = $this->_parseOptions($fieldName, $options);

        $options['type'] = __FUNCTION__;
        if ($error !== '') {
            $options['error'] = $error;
            $errorSuffix = 'Error';
        }

        $result = $this->_inputContainerTemplate([
            'error'       => $error,
            'content'     => $content,
            'options'     => $options,
            'errorSuffix' => $errorSuffix
        ]);

        return $result;
    }
906882
public function checkbox($options)
    {

        if (is_string($options)) {
            $options = ['class' => $options];
        }

        if (!Arr::has($options, 'type')) {
            Arr::set($options, 'type', 'checkbox');
        }

        return $this->input($options);
    }
554151
private function mapFieldName($fieldName)
    {
        if (isset($this->fieldNameMapping[$fieldName])) {
            $fieldName = $this->fieldNameMapping[$fieldName];
        }

        return $fieldName;
    }
124130
public function val($field, $options = [])
    {
        $val = parent::val($field, $options);
        if ($val === null) {
            $parts  = explode('.', $field);
            $entity = $this->entity($parts);

            if ($entity instanceof Data) {
                $key = array_pop($parts);
                $val = $entity->get($key);
            }
        }

        return $val;
    }
23554
public function input($name, $options = array())
    {
        $options += array(
            "type"  => "text",
            "id"    => $this->id($name),
            "name"  => $this->name($name),
            "error" => true,
            "class" => "",
            "value" => "",
            "label" => null
        );

        $currentValue = $this->getCurrentValue($options['name']);

        $errorHtml = "";
        $fieldHasErrors = false;

        if (!is_null($this->associatedEntity)) {
            // Checkboxes may be posted has data[name][0] and therefore
            // we need to remove it to get the absolute field name.
            $validationName = $options["type"] === "checkbox" ?
                preg_replace('/\[\d+\]$/', '', $name) :
                $name;

            if ($this->associatedEntity->hasErrors($validationName)) {
                if ((bool)$options['error']) {
                    $errorHtml = $this->generateInlineErrors($validationName);
                }
                $fieldHasErrors = true;
                $options['class'] .= " error ";
            }
        }
        unset($options["error"]);

        $label = "";
        if (!is_null($options['label'])) {
            $labelOptions = array(
                "for"    => $options["id"],
                "class" => $fieldHasErrors ? "error" : "",
                "label" => $options["label"],
            );

            $label .= $this->label($options['name'], $labelOptions);
        }
        unset($options['label']);

        switch (strtolower($options['type'])) {
            case "textarea":
                return $label . "\n" . $this->generateTextarea($options, $currentValue) . $errorHtml . "\n";
            case "select":
                return $label . "\n" . $this->generateSelect($options, $currentValue) . $errorHtml . "\n";
            case "radio":
                return $this->generateRadio($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "checkbox":
                return $this->generateCheckbox($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "hidden":
                return $label . "\n" . $this->generateHidden($options, $currentValue) . $errorHtml . "\n";
            default:
                return $label . "\n" . $this->generateTextinput($options, $currentValue) . $errorHtml . "\n";
        }
    }
213632
protected function getConsoleOptionInput($optionName)
    {
        $value = $this->consoleInput->getOption($optionName);

        if ($value) {
            $transformedCorrectly = true;

            try {
                $newValue = $this->transformValue($value, $optionName);
            } catch (LogicException $e) {
                $transformedCorrectly = false;

                // Present an error to indicate why the option wasn't accepted
                $this->consoleIo->block($e->getMessage(), 'ERROR', 'fg=white;bg=red;', ' ', true);
            }

            if ($transformedCorrectly) {
                return $newValue;
            }
        }

        $optionIsPromptable = in_array($optionName, $this->consolePrompts);

        if ( ! $optionIsPromptable) {
            return null;
        }

        $description = $this->getQuestionText($optionName);

        if ( ! $this->consoleInput->isInteractive()) {
            throw new \Exception(
                sprintf('Cannot prompt for %s, command is running in non-interactive mode', $optionName)
            );
        }

        /** @var QuestionHelper $question */
        $value = $this->consoleIo->ask(
            $description,
            null,
            function($value) use($optionName) {
                $noValue    = ($value === '' || $value === null);
                $isRequired = $this->promptConfig[$optionName]['required'];
                
                if ($noValue && $isRequired) {
                    throw new LogicException("A value is required.");
                }
                
                $value = $this->transformValue($value, $optionName);
                
                return $value;
            }
        );
        
        // If the transformer returned a null value and the input isn't required, resort to default value
        if ( ! $this->promptConfig[$optionName]['required'] && $value === null) {
            $value = $this->promptConfig[$optionName]['default'];
        }

        return $value;
    }
495976
public function relField($fieldName)
    {
        // default case
        if ($value = parent::relField($fieldName)) {
            return $value;
        }

        // check values for a form field with the matching name.
        $formField = SubmittedFormField::get()->filter(array(
            'ParentID' => $this->ID,
            'Name' => $fieldName
        ))->first();

        if ($formField) {
            return $formField->getFormattedValue();
        }
    }
222988
public function chosen($fieldName, $options = [])
    {
        $defaults = [
            'div' => [
                'class' => 'form-group',
            ],
            'class' => 'form-control form-control-chosen',
            'empty' => true,
        ];

        if (isset($options['class'])) {
            $defaults = parent::addClass($defaults, $options['class']);
            unset($options['class']);
        }
        $options = array_merge($defaults, $options);
        return parent::input($fieldName, $options);
    }
103163
public function checkbox($fieldName, array $options = [])
    {
        $options = optionsParser($options);

        if (!$options->exists('hiddenField') || !$options->contains('hiddenField', false)) {
            $options->add('hiddenField', true);
        }

        return parent::checkbox($fieldName, $options->toArray());
    }
43942
public static function getFieldValue(InputInterface $input, $fieldName)
    {
        $value = null;

        if ($input->hasArgument($fieldName)) {
            $value = $input->getArgument($fieldName);
        } elseif ($input->hasOption($fieldName)) {
            $value = $input->getOption($fieldName);
        }

        return $value;
    }
759776
public function fieldValue(array &$submitted, array $options = array())
    {
        $this->options = $options;
        $this->submitted = &$submitted;

        $this->validateFieldValue();
        $this->validateTitle();
        $this->validateWeight();
        $this->validateTranslation();
        $this->validateFieldFieldValue();
        $this->validateColorFieldValue();
        $this->validateUploadImages('field_value');

        $this->unsetSubmitted('update');
        $this->unsetSubmitted('field');

        return $this->getResult();
    }
116892
public function radio($fieldName, $options = array(), $attributes = array()) {
		$attributes = $this->_initInputField($fieldName, $attributes);
		$showEmpty = $this->_extractOption('empty', $attributes);
		if ($showEmpty) {
			$showEmpty = ($showEmpty === true) ? __d('cake', 'empty') : $showEmpty;
			$options = array('' => $showEmpty) + $options;
		}
		unset($attributes['empty']);

		$legend = false;
		if (isset($attributes['legend'])) {
			if ($attributes['legend'] === true) {
				$legend = __(Inflector::humanize($this->field()));
			} else {
				$legend = $attributes['legend'];
			}
			unset($attributes['legend']);
		}

		$label = true;
		if (isset($attributes['label'])) {
			$label = $attributes['label'];
			unset($attributes['label']);
		}

		$separator = null;
		if (isset($attributes['separator'])) {
			$separator = $attributes['separator'];
			unset($attributes['separator']);
		}

		$between = null;
		if (isset($attributes['between'])) {
			$between = $attributes['between'];
			unset($attributes['between']);
		}

		// Opcion inline
		$inline = null;
		if ($this->_getCustom('inline')) {
			$inline = $this->_getCustom('inline');
			unset($attributes['inline']);
		}

		$value = null;
		if (isset($attributes['value'])) {
			$value = $attributes['value'];
		} else {
			$value = $this->value($fieldName);
		}

		$disabled = array();
		if (isset($attributes['disabled'])) {
			$disabled = $attributes['disabled'];
		}

		$out = array();

		$hiddenField = isset($attributes['hiddenField']) ? $attributes['hiddenField'] : true;
		unset($attributes['hiddenField']);

		if (isset($value) && is_bool($value)) {
			$value = $value ? 1 : 0;
		}

		$this->_domIdSuffixes = array();
		foreach ($options as $optValue => $optTitle) {
			$optionsHere = array('value' => $optValue, 'disabled' => false);

			if (isset($value) && strval($optValue) === strval($value)) {
				$optionsHere['checked'] = 'checked';
			}
			$isNumeric = is_numeric($optValue);
			if ($disabled && (!is_array($disabled) || in_array((string)$optValue, $disabled, !$isNumeric))) {
				$optionsHere['disabled'] = true;
			}
			$tagName = $attributes['id'] . $this->domIdSuffix($optValue);

			if (is_array($between)) {
				$optTitle .= array_shift($between);
			}
			$allOptions = array_merge($attributes, $optionsHere);

			$allOptions['class'] = null;
			if (isset($options['class'])) {
				$allOptions['class'] = $options['class'];
			}
			$optHtml = $this->Html->useTag('radio', $attributes['name'], $tagName,
				array_diff_key($allOptions, array('name' => null, 'type' => null, 'id' => null)),
				''
			);

			// Wraps radio inside label
			$labelOpts = array();
			$labelOpts += array('for' => $tagName);

			if ($inline) {
				$labelOpts['class'] = 'radio-inline';
			}
			$optLabel = $this->label($tagName, $optHtml . ' ' . $optTitle, $labelOpts);

			// If it is not an inline group, wrap input inside div.radio
			if (!$inline) {
				$optLabel = $this->Html->tag('div', $optLabel, array('class' => 'radio'));
			}

			$out[] = $optLabel;
		}
		$hidden = null;

		if ($hiddenField) {
			if (!isset($value) || $value === '') {
				$hidden = $this->hidden($fieldName, array(
					'id' => $attributes['id'] . '_', 'value' => '', 'name' => $attributes['name']
				));
			}
		}
		$out = $hidden . implode($separator, $out);

		if (is_array($between)) {
			$between = '';
		}
		if ($legend) {
			$out = $this->Html->useTag('fieldset', '', $this->Html->useTag('legend', $legend) . $between . $out);
		}

		return $out;
	}
1127886
public static function hasMigrationFields(string $moduleName, array $fields, array $options = []): bool
    {
        $config = (new ModuleConfig(ConfigType::MIGRATION(), $moduleName, null, $options))->parseToArray();

        $fieldKeys = array_flip($fields);
        $diff = array_diff_key($fieldKeys, $config);

        return empty($diff);
    }
312039
public function textInput(array $options = [])
    {
        $this->element = Angular::text('{model}', '{label}', [
            'fieldid' => $this->form->getFieldId($this->attribute),
            'ng-init' => '{initValue}',
        ]);
        
        return $this;
    }
1366317
public function getSourceValue($fieldname, $options = [])
    {
        $valueMap = [
            'data' => 'getData',
            'query' => 'getQuery'
        ];
        foreach ($this->getValueSources() as $valuesSource) {
            if ($valuesSource === 'context') {
                $val = $this->_getContext()->val($fieldname, $options);
                if ($val !== null) {
                    return $val;
                }
            }
            if (isset($valueMap[$valuesSource])) {
                $method = $valueMap[$valuesSource];
                $value = $this->_View->getRequest()->{$method}($fieldname);
                if ($value !== null) {
                    return $value;
                }
            }
        }

        return null;
    }
825026
public function findField($field=null, $options=null)
    {
        if ($field) {
            $this->select($field);
        }
        $ret = $this->find($options);
        
        return $ret ? array_values($ret)[0] : null;
    }