Backend\Modules\Location\Actions\Edit::execute PHP Method

execute() public method

Execute the action
public execute ( )
    public function execute()
    {
        $this->id = $this->getParameter('id', 'int');
        // does the item exists
        if ($this->id !== null && BackendLocationModel::exists($this->id)) {
            $this->header->addJS(FrontendLocationModel::getPathToMapStyles());
            parent::execute();
            // define Google Maps API key
            $apikey = $this->get('fork.settings')->get('Core', 'google_maps_key');
            // check Google Maps API key, otherwise redirect to settings
            if ($apikey === null) {
                $this->redirect(BackendModel::createURLForAction('Index', 'Settings'));
            }
            // add js
            $this->header->addJS('https://maps.googleapis.com/maps/api/js?key=' . $apikey, null, false, true, false);
            $this->loadData();
            $this->loadForm();
            $this->validateForm();
            $this->loadSettingsForm();
            $this->parse();
            $this->display();
        } else {
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
        }
    }