<? if ( is_array( $this -> custom_fields ) ):?>
  <? foreach ( $this -> custom_fields as $custom_field ):?>
  <div class="custom-field">
    <div class="_name <? if ( !empty( $custom_field['is_required'] ) ): ?>bold<? endif; ?>">
      <?= $custom_field['name'];?><? if ( !empty( $custom_field['is_required'] ) ): ?>*<? endif; ?>:
    </div>
    <div class="_input">
      <div class="grow-wrap">
        <textarea name="custom_field[<?= $custom_field['id_additional_field'];?>]" field_name="<?= $custom_field['name'];?>" onInput="this.parentNode.dataset.replicatedValue = this.value" <? if ( !empty( $custom_field['is_required'] ) ): ?>required<? endif; ?>></textarea>
      </div>
    </div>
  </div>
  <? endforeach;?>
  <? if ( array_filter( $this -> custom_fields, fn( $field ) => !empty( $field['is_required'] ) ) ): ?>
    <div class="custom-field">
      <div class="_name"></div>
      <div class="_input">
        * - pole wymagane
      </div>
    </div>
  <? endif;?>
<? endif;?>