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

field.scope.php

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

$attributes = $Field->getFieldAttributes(array(
    'class' => 'field--scope',
    'id' => $Field->id('-field'),
));
print '<div';
foreach ($attributes as $attributeName => $attributeValue) if ($attributeValue !== null) print ' ' . $attributeName . '="' . $attributeValue . '"';
print '>';

print $Field->node->display(false);

print '</div>';

if ($Field->name) {
    $attributes = $Field->getInputAttributes(array(
        'type' => 'hidden',
        'name' => $Field->name,
        'value' => $Field->v(),
        'placeholder' => strval($Field->placeholder) !== '' ? htmlspecialchars($Field->placeholder) : null,
        'required' => $Field->required ? '' : null,
        'readonly' => $Field->readonly ? '' : null,
        'disabled' => $Field->disabled ? '' : null,
        'id' => $Field->id('-input'),
        'data-type' => $Field->json ? 'json' : null,
    ));
    print '<input';
    foreach ($attributes as $attributeName => $attributeValue) if ($attributeValue !== null) print ' ' . $attributeName . '="' . $attributeValue . '"';
    print '>';
}

?>
<script>
cmsRequire(['form/script/input.scope'], init => init(document.getElementById(<?=$Field->jId('-input')?>), { el: document.getElementById(<?=$Field->jId('-field')?>) }));
</script>