![Gitter](https://badges.gitter.im/Join Chat.svg)
This module makes it possible to import OpenImmo-Data into an existing MetaModel.
The contents of the contao
folder needs to be placed within the folder system/modules/metamodels_openimmo/
, while the the src
folder needs to go to composer/anzui/metamodels_openimmo/src
.
You can save a lot of time and work by importing the pre-made template.
It consists of the MetaModel "immo" and pre-configured attributes and the corresponding MetaModel-OpenImmo link.
Warning: Importing the template will erase all of your existing MetaModels and MetaModels-OpenImmo links.
For each MetaModels-OpenImmo Link you can configure automatic syncing and deletion of old files.
This automation uses Contao's cron service. By default it requires the page to be called by any web browser regulary to work.
You can also setup Contao's cron service to be executed by your systems cron.
You can add a callback function to each field-link.
It will be passed the value from the XML, the field object, the immo-array, the xml tree, the current xpath and the metamodel attribute.
It must return the value to be set on the field.
public static function fieldCallback($value, $field_obj, &$immo, &$xml, $xpath, $metamodelAttribute)
{
...
return $value;
}
MetaModels - OpenImmo provides a hook that is called for each item that will be synced with the database
$GLOBALS['TL_HOOKS']['metaModelsOpenImmoSync'][] = array('MyClass', 'myMethod')
It gets passed an array containing all synced fields and the original XML tree for that particular object within the _xml_
key of the array.
It must return the array. Every modification you made to it will be stored in the database.