本文整理汇总了PHP中Field::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::getType方法的具体用法?PHP Field::getType怎么用?PHP Field::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateFilledInFieldCustom
/**
* Validates a filled in field wrt. custom constraints.
*
* @return string (X)HTML.
*/
protected function validateFilledInFieldCustom()
{
$o = '';
if (function_exists('advfrm_custom_valid_field')) {
$value = $this->field->getType() == 'file' ? $_FILES[$this->name] : stsl($_POST[$this->name]);
$valid = advfrm_custom_valid_field($this->formId, $this->field->getName(), $value);
if ($valid !== true) {
$o .= '<li>' . $valid . '</li>' . PHP_EOL;
Controller::focusField($this->formId, $this->name);
}
}
return $o;
}
示例2: isFieldVisible
/**
* Returns whether a field is visible.
*
* @param Field $field A field.
*
* @return bool
*/
protected function isFieldVisible(Field $field)
{
return ($field->getType() != 'hidden' || $this->showHidden) && $field->getType() != 'output';
}
示例3: renderButtonInput
protected static function renderButtonInput(Field $field)
{
return sprintf('<button type="%s" name="%s" value="%s" %s>%s</button>', $field->getType(), $field->getName(), $field->getValue(), $field->getAttributes(), $field->getLabel());
}
示例4: isLabelled
/**
* Returns whether a field is labelled.
*
* @param Field $field A field.
*
* @return bool
*/
protected function isLabelled(Field $field)
{
return !in_array($field->getType(), array('checkbox', 'radio', 'hidden'));
}
示例5: getInputElementType
/**
* Returns the value of the type attribute of an input element.
*
* @return string
*/
protected function getInputElementType()
{
return in_array($this->field->getType(), array('file', 'password', 'hidden')) ? $this->field->getType() : 'text';
}
示例6: changeFieldToNotNullable
/**
* Change column from null to not null
* @param Field $field
*/
public function changeFieldToNotNullable($field)
{
$result = PerfORMController::getConnection()->query('select * from %n where %n is null', $field->getModel()->getTableName(), $field->getName());
$pk = $field->getModel()->getPrimaryKey();
foreach ($result as $row) {
if (!is_null($value = $field->getDefaultValue())) {
} elseif (is_callable($field->getDefaultCallback())) {
$value = call_user_func($field->getDefaultCallback(), $row);
} else {
throw new Exception("Unable to set default value for field '" . $field->getName() . "'");
}
PerfORMController::getConnection()->query('update %n set %n = %' . $field->getType() . ' where %n = %i', $field->getModel()->getTableName(), $field->getName(), $value, $pk, $row->{$pk});
}
PerfORMController::getBuilder()->changeFieldsNullable($field);
$this->updateFieldSync($field);
}