public function delete() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $custom_block_id = (int) $this->request->get['custom_block_id']; $layout = new ALayoutManager(); if (!$layout->deleteCustomBlock($custom_block_id)) { $this->session->data['warning'] = $this->language->get('error_delete'); } else { $this->session->data['success'] = $this->language->get('text_success_deleted'); } //update controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); $this->redirect($this->html->getSecureURL('design/blocks')); }
<?php if (!defined('DIR_CORE')) { header('Location: static_pages/'); } // delete block $lm = new ALayoutManager(); $lm->deleteBlock('default_pp_express_button'); $lm->deleteBlock('default_pp_express_banner'); $block_names = array('paypal_billmelater_marketing'); $custom_blocks = $lm->getBlocksList(array('subsql_filter' => 'cb.custom_block_id <> 0')); foreach ($custom_blocks as $block) { if (in_array($block['block_name'], $block_names)) { $this->db->query("DELETE FROM " . DB_PREFIX . "block_layouts\n\t\t\t\t\t\t WHERE custom_block_id = '" . (int) $block['custom_block_id'] . "'"); $this->cache->delete('layout.a.blocks'); $this->cache->delete('layout.blocks'); $lm->deleteCustomBlock($block['custom_block_id']); } } $rm = new AResourceManager(); $rm->setType('image'); $resources = $rm->getResources('extensions', 'default_pp_express'); if (is_array($resources)) { foreach ($resources as $resource) { $rm->deleteResource($resource['resource_id']); } }