Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heimrichhannot/contao-formhybrid_list
A generic list module using formhybrid for filtering.
https://github.com/heimrichhannot/contao-formhybrid_list
Last synced: about 1 month ago
JSON representation
A generic list module using formhybrid for filtering.
- Host: GitHub
- URL: https://github.com/heimrichhannot/contao-formhybrid_list
- Owner: heimrichhannot
- Created: 2015-09-28T09:16:08.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T09:24:39.000Z (almost 2 years ago)
- Last Synced: 2024-11-10T04:15:30.218Z (about 1 month ago)
- Language: PHP
- Size: 595 KB
- Stars: 3
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Formhybrid List
Contains a list and a reader module in a generic flavor. The modules can display and process all kinds of contao entities containing filtering, pagination, modal handling, ...
If additional functionality is needed, one simply has to inherit from ModuleList or ModuleReader.
-> Click [here](docs/formhybrid.png) for a diagram visualizing the interaction between the modules [formhybrid](https://github.com/heimrichhannot/contao-formhybrid), [formhybrid_list](https://github.com/heimrichhannot/contao-formhybrid_list), [frontendedit](https://github.com/heimrichhannot/contao-frontendedit) and [submissions](https://github.com/heimrichhannot/contao-submissions).
## Features
### List module
- display any contao entity
- sorting by field or free text
- pagination (ajax or synchronous)
- infinite scroll
- advanced filtering using heimrichhannot/contao-formhybrid
- defining of default filters
- detail links with alias support
- opening instances in modal windows (install heimrichhannot/contao-modal for this)
- display as table with sortable headers
- share entities in a list (add the necessary fields to your dca beforehands by using ```FormHybridList::addShareFields()```)### Reader module
- display any contao entity
- support for id or alias
- security handling## Technical instructions
### Access to data in list item templates
Usually you'll want to override the formybrid_list_item_default.html5 template. Inside this template you have access to the fields of the linked entity using the following techniques:
- $this->someField
- $this->fields (formatted fields)
- $this->raw (unformatted fields as stored in the database)### Example CSS for the masonry
```
.formhybrid-list {
.items {
.make-row();.item, .stamp-item {
.make-xs-column(12);
.make-sm-column(6);
.make-md-column(4);
.make-lg-column(4);
margin-bottom: 40px;
}
}
}
```### Customize list filter processing behavior
Just create a submodule of ModuleList, add the following function and adjust it to your needs (same is possible for customizeDefaultFilters() which are the initial filters).
Hint: You can also return multiple values for one field as array.
```
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;
}
}
```### Modules
Name | Description
---- | -----------
ModuleList | A generic list module able to display all kinds of contao entities containing filtering, pagination, ...
ModuleMemberList | Encapsulates member specific changes overriding ModuleList
ModuleNewsList | Encapsulates news specific changes overriding ModuleList
ModuleReader | A generic reader module able to display all kinds of contao entities
ModuleMemberReader | Encapsulates news specific changes overriding ModuleList
ModuleListFilter | Detached filter that can be placed independently from ModuleList### Hooks
Name | Arguments | Description
---- | --------- | -----------
parseItems | $objTemplate, $arrItem, $objModule | Triggered just before FrontendTemplate::parse() is called### Insert Tags
Name | Arguments | Example
---- | --------- | -------
fhl_filter_url | page id – the page that contains the list module,
module id – the formhybrid_list list module -> ModuleList or inheriting class,
filter query – url encoded | {{fhl_filter_url::1::5::city=Dresden&company=Heimrich+%26+Hannot}}