";
$labelPlacement = ArrayHelper::get($data, 'settings.label_placement');
$labelPlacementClass = '';
if ($labelPlacement) {
$labelPlacementClass = ' ff-el-form-' . $labelPlacement;
}
list($headers, $content) = $this->getCsvData($data, $form);
$inited = false;
foreach ($headers as $key => $field) {
$element = [
'settings' => $data['settings'],
'attributes' => $data['attributes']
];
$element['settings']['label'] = $field;
$element['attributes']['name'] = $rootName . '[' . $field . ']';
$element['attributes']['class'] = 'ff-el-form-control ' . $elementClass;
if ($tabIndex = \FluentForm\App\Helpers\Helper::getNextTabIndex()) {
$element['attributes']['tabindex'] = $tabIndex;
}
$element['settings']['container_class'] = $labelPlacementClass;
$element['attributes']['id'] = $this->makeElementId($element, $form);
$options = "
";
if ($key == 0) {
foreach (array_unique(array_column($content, $field)) as $value) {
$options .= "
";
}
}
$elementAttributes = ArrayHelper::except(
$element['attributes'], ['type', 'data-type', 'placeholder']
) + [
'data-index' => $key,
'data-meta_key' => $element['settings']['data_source']['meta_key'],
'data-source-type' => $element['settings']['data_source']['type'],
'data-source-url' => $element['settings']['data_source']['url']
];
$elementAttributes['class'] = $elementAttributes['class'] . ' el-chained-select';
if ($isSmartSearch) {
$elementAttributes['class'] .= ' ff_el-chained-select-smart-search';
}
$elementAttributes['data-key'] = $field;
$elementAttributes = $this->buildAttributes($elementAttributes);
$elMarkup = "
";
if($inited) {
$element['settings']['help_message'] = '';
}
$inited = true;
$markup = $this->buildElementMarkup($elMarkup, $element, $form);
$html .= "
{$markup}
";
}
$html .= "