PHP code example of heimrichhannot / contao-formhybrid_list

1. Go to this page and download the library: Download heimrichhannot/contao-formhybrid_list library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heimrichhannot / contao-formhybrid_list example snippets


protected function customizeFilters(&$strField, &$strColumn, &$varValue, &$blnSkipValue = false)
{
    $arrData = $this->objFilterForm->getDca();

    switch ($strField)
    {
        case 'startDate':
            $strColumn = 'startDate >= ?';
            $varValue = strtotime(str_replace('%', '', $varValue));
            break;
        case 'endDate':
            $strColumn = 'startDate <= ?';
            $varValue = strtotime(str_replace('%', '', $varValue));
            break;
        case 'city':
            $strColumn = 'city = ?';
            $varValue = $arrData['fields'][$strField]['options'][$varValue];
            break;
        case 'fsonly':
            if (\Input::get('fsonly') === '0')
            {
                $strColumn = 'pid != 1';
            }
            else if (\Input::get('fsonly') === '1')
            {
                $strColumn = 'pid = 1';
            }
            break;
    }
}