Backend\Modules\Locale\Actions\Delete::execute PHP Method

execute() public method

Execute the action
public execute ( )
    public function execute()
    {
        $this->id = $this->getParameter('id', 'int');
        // does the item exist
        if ($this->id !== null && BackendLocaleModel::exists($this->id) && BackendAuthentication::getUser()->isGod()) {
            parent::execute();
            // filter options
            $this->setFilter();
            // get data
            $this->record = (array) BackendLocaleModel::get($this->id);
            // delete item
            BackendLocaleModel::delete(array($this->id));
            // trigger event
            BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
            // build redirect URL
            $redirectUrl = BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['name'] . ' (' . mb_strtoupper($this->record['language']) . ')') . $this->filterQuery;
            // item was deleted, so redirect
            $this->redirect($redirectUrl);
        } else {
            $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
        }
    }