startpoint
Active Member
How to override layout for filters for database join element? Filters type is dropdown. I saw that have override for checkbox filter type, but I need override for dropdown type.
We have now opened a commercial services section here on the forum for registered users. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.
Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.
For running J!5.1 you must https://fabrikar.com/forums/index.php?wiki/update-from-github/ or include the new file manually https://fabrikar.com/forums/index.php?threads/joomla-5-1-and-fabrik-cannot-find-files-error.54473/post-285151 See also Announcements
How to create jlayout for dropdown filter type?
<?php
defined('JPATH_BASE') or die;
$d = $displayData;
echo JHTML::_('select.genericlist', $d->rows, $d->v, 'class="' . $d->class . '" ' . $d->size . ' ' . $d->data, 'value', 'text', $d->default, $d->id);
protected function selectFilter($rows, $default, $v)
{
$class = $this->filterClass();
$element = $this->getElement();
$id = $this->getHTMLId() . 'value';
if ($element->filter_type === 'dropdown' || $element->filter_type === 'multiselect')
{
$advancedClass = $this->getAdvancedSelectClass();
$class .= !empty($advancedClass) ? ' ' . $advancedClass : '';
}
$max = count($rows) < 7 ? count($rows) : 7;
$size = $element->filter_type === 'multiselect' ? 'multiple="multiple" size="' . $max . '"' : 'size="1"';
$v = $element->filter_type === 'multiselect' ? $v . '[]' : $v;
$data = 'data-filter-name="' . $this->getFullName(true, false) . '"';
$default = (array) $default;
$layout = $this->getLayout('list-filter-dropdown');
$displayData = new stdClass;
$displayData->rows = $rows;
$displayData->v = $v;
$displayData->size = $size;
$displayData->data = $data;
$displayData->default = $default;
$displayData->id = $id;
$displayData->class = $class;
$res = $layout->render($displayData);
if($res == ''){
$layout = $this->getListModel()->getLayout('list.filter.fabrik-filter-dropdown');
$res = $layout->render($displayData);
}
return $res;
}