/** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * @since 1.6 */ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState($this->option . '.edit.project.data', array()); if (empty($data)) { $data = $this->getItem(); if (!empty($data->location)) { // Load location from database. jimport("crowdfunding.location"); $location = new CrowdFundingLocation(JFactory::getDbo()); $location->load($data->location); $locationName = $location->getName(true); // Set the name to the form element. if (!empty($locationName)) { $data->location_preview = $locationName; } } } return $data; }
/** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * @since 1.6 */ protected function loadFormData() { $app = JFactory::getApplication(); /** @var $app JApplicationSite * */ $data = $app->getUserState($this->option . '.edit.project.data', array()); if (!$data) { $itemId = (int) $this->getState($this->getName() . '.id'); $userId = JFactory::getUser()->get("id"); $data = $this->getItem($itemId, $userId); if (!empty($data->location)) { // Load location from database. jimport("crowdfunding.location"); $location = new CrowdFundingLocation(JFactory::getDbo()); $location->load($data->location); $locationName = $location->getName(true); // Set the name to the form element. if (!empty($locationName)) { $data->location_preview = $locationName; } } } return $data; }