shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

language.php (695B)


      1 <?php
      2 class ControllerEventLanguage extends Controller {
      3 	public function index(&$route, &$args) {
      4 		foreach ($this->language->all() as $key => $value) {
      5 			if (!isset($args[$key])) {
      6 				$args[$key] = $value;
      7 			}
      8 		}
      9 	}	
     10 	
     11 	// 1. Before controller load store all current loaded language data
     12 	public function before(&$route, &$output) {
     13 		$this->language->set('backup', $this->language->all());
     14 	}
     15 	
     16 	// 2. After contoller load restore old language data
     17 	public function after(&$route, &$args, &$output) {
     18 		$data = $this->language->get('backup');
     19 		
     20 		if (is_array($data)) {
     21 			foreach ($data as $key => $value) {
     22 				$this->language->set($key, $value);
     23 			}
     24 		}
     25 	}
     26 }