field.array.php
Исходный код
<?php
$attributes = $Field->getFieldAttributes(array(
'class' => 'field--array',
'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.array'], init => init(document.getElementById(<?=$Field->jId('-input')?>), { el: document.getElementById(<?=$Field->jId('-field')?>) }));
</script>