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

input.url.php

Поле URL.

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

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

# Не используем type="url", так как не хотим вводить домен для ссылок на страницы сайта
$type = 'text';
$attributes = $Field->getInputAttributes(array(
    'grid-margin' => $Field->getInputMargin(),
    'grid-width' => $Field->getInputWidth(),
    'type' => $type,
    'name' => $Field->name,
    'value' => $Field->v(),
    'inputmode' => 'url',
    '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 '>';

?>

<script>
cmsRequire(['form/script/input.url'], init => init(document.getElementById(<?=$Field->jId('-input')?>)));
</script>