Example #1
0
 /**
  * Edit module interface
  * (internationalization module)
  */
 protected function module_i18n()
 {
     if (!isset($this->cms_modules[$this->config_mod['cms_module']])) {
         return false;
     }
     $data = Arr::get($_POST, 'data', []);
     if ($this->request->is_post()) {
         $path = $this->cms_modules[$this->config_mod['cms_module']] . 'i18n' . DS . $this->language . EXT;
         File::var_export($data, $path);
         Message::success(__('settings.changes_saved'));
         HTTP::redirect(Route::url(Request::get('routename'), ['controller' => Request::get('controller'), 'action' => 'i18n']));
     }
     $group = str_replace('cms_', '', $this->config_mod['cms_module']);
     foreach (I18n::load($this->language) as $key => $val) {
         if (preg_match('/^' . $group . '\\./', $key)) {
             $data[$key] = $val;
         }
     }
     $this->title = $this->config_mod['cms_module'] == 'cms_settings' ? __('settings.i18n_edit_global') : __('settings.i18n_edit_iface');
     $this->content = View::factory('backend/v_i18n', ['data' => $data]);
 }