<?php
/**
* Copyright (C) 2021 Rhyme Digital, LLC.
*
* @link https://rhyme.digital
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
namespace Rhyme\WMassArtsHub\Hooks\LoadFormField;
use Contao\Frontend;
use Rhyme\WMassArtsHub\Helper\CategoryHelper;
/**
* Class LoadCategoryOptions
* @package Rhyme\Noho\Hooks\LoadFormField
*/
class LoadCategoryOptions extends Frontend
{
/**
* Load category field options
* @param $objWidget
* @param $formId
* @param $arrData
* @param $objForm
* @return object
*/
public static function run($objWidget, $formId, $arrData, $objForm)
{
if (($objWidget->name == 'categories' || $objWidget->name == 'categories[]') && in_array($arrData['formID'], array('eventSubmission'))) {
CategoryHelper::addOptionsToWidget($objWidget);
}
return $objWidget;
}
}