Система управления «Сайт PRO»
Версия 20240107

input.default.php

Текстовое поле

Вызывается из:

Исходный код
<?php

if ($Field->type === 'text') {
    $type = 'text';
} elseif ($Field->type === 'password') {
    $type = 'password';
} elseif ($Field->type === 'email') {
    $type = 'email';
} elseif ($Field->type === 'tel') {
    $type = 'tel';
} elseif ($Field->type === 'number') {
    $type = 'number';
} elseif ($Field->type === 'search') {
    $type = 'search';
} else {
    $type = 'text';
}
$attributes = $Field->getInputAttributes(array(
    'grid-margin' => $Field->getInputMargin(),
    'grid-width' => $Field->getInputWidth(),
    'type' => $type,
    'name' => $Field->name,
    'value' => $Field->type === 'password' ? null : $Field->v(),
    'placeholder' => strval($Field->placeholder) !== '' ? htmlspecialchars($Field->placeholder) : null,
    'required' => $Field->required ? '' : null,
    'readonly' => $Field->readonly ? '' : null,
    'disabled' => $Field->disabled ? '' : null,
    'class' => 'field-input field-input--' . $Field->type . ' input input--' . $Field->type,
    'id' => $Field->id('-input'),
));
print '<input';
foreach ($attributes as $attributeName => $attributeValue) if ($attributeValue !== null) print ' ' . $attributeName . '="' . $attributeValue . '"';
print '>';

?>