<?php
$filter_form = null;
if (isset($filter['form'])) {
    $filter_form = $this->View_FilterForm_render($filter['form'], null, !empty($filter['is_external']));
}
$html = [];
if (!empty($nav[0])) {
    $html['.drts-view-entities-header'] = $this->View_Nav($CONTEXT, $nav[0]);
}
if (!empty($nav[1])) {
    $html['.drts-view-entities-footer'] = $this->View_Nav($CONTEXT, $nav[1], true);
}
if ($filter_form && empty($filter['is_external'])) {
    $html['.drts-view-entities-filter-form'] = $filter_form;
}
if ((string)$view !== 'map') { // Map view does not need to render entities list
    $html['.drts-view-entities'] = $this->render($settings['template'], $CONTEXT->getAttributes());
}
echo $this->JsonEncode(array(
    'html' => $html,
    'filter_form' => empty($filter['is_external']) ? null : $filter_form,
));