/** * Retrieve all database table names. * * @param GetPropertyOptionsEvent $event The event. * * @return void */ public static function getCountriesByContinent(GetPropertyOptionsEvent $event) { if ($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_attribute' || $event->getPropertyName() !== 'geoprotection') { return; } // Get the current values. $arrValues = $event->getOptions(); // Call the helper to get all data. $arrValues = Helper::getCountriesByContinent($arrValues); // Set the new options. $event->setOptions($arrValues); }
/** * Returns an array with selected countries. * * @return array|null */ public function getSelectedCountries() { $objValue = \Database::getInstance()->prepare('SELECT geoprotection FROM tl_metamodel_attribute WHERE id = ?')->limit(1)->execute($this->get('id')); return Helper::getCountriesByContinent(deserialize($objValue->geoprotection)); }