<?php

/**
 * OBG Customizations
 *
 * Copyright (c) 2021 vonRotenberg
 *
 * @license commercial
 */

use vonRotenberg\RealEstateListingBundle\Model\RealEstateAssetsModel;
use Contao\System;
use Contao\ArrayUtil;
use vonRotenberg\RealEstateListingBundle\Model\RealEstateCategoriesModel;

ArrayUtil::arrayInsert($GLOBALS['BE_MOD'], 1, [
  'vr_real_estate' => [
    'vr_re_categories' => [
      'tables' => array('tl_vr_real_estate_categories','tl_vr_real_estate_assets')
    ]
  ]
]);

// Style sheet
$scopeMatcher = System::getContainer()->get('contao.routing.scope_matcher');
$requestStack = System::getContainer()->get('request_stack');
if ($requestStack->getCurrentRequest() !== null && $scopeMatcher->isBackendRequest($requestStack->getCurrentRequest()))
{
    $GLOBALS['TL_CSS'][] = 'bundles/vonrotenbergrealestatelisting/css/sr_vr_real_estate.css|static';
}

$GLOBALS['TL_MODELS']['tl_vr_real_estate_assets'] = RealEstateAssetsModel::class;
$GLOBALS['TL_MODELS']['tl_vr_real_estate_categories'] = RealEstateCategoriesModel::class;


