From 984e09a024bdbcfa00c7614c5183ca9feab184b2 Mon Sep 17 00:00:00 2001 From: David McReynolds Date: Thu, 1 Oct 2015 16:27:32 -0700 Subject: [PATCH] fixes for if the data being saved for a display_field is an array --- fuel/modules/fuel/controllers/module.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fuel/modules/fuel/controllers/module.php b/fuel/modules/fuel/controllers/module.php index a45149b1d..29cb71ea8 100644 --- a/fuel/modules/fuel/controllers/module.php +++ b/fuel/modules/fuel/controllers/module.php @@ -963,7 +963,8 @@ protected function _process_create() if ( ! empty($data)) { - $msg = lang('module_edited', $this->module_name, $data[$this->display_field]); + $msg_data = (is_array($data[$this->display_field])) ? json_encode($data[$this->display_field]) : $data[$this->display_field]; + $msg = lang('module_edited', $this->module_name, $msg_data); $this->fuel->logs->write($msg); $this->_clear_cache(); return $id; @@ -1069,9 +1070,10 @@ function edit($id = NULL, $field = NULL, $redirect = TRUE) $crumbs = array($this->module_uri => $this->module_name); + $msg_data = (is_array($data[$this->display_field])) ? json_encode($data[$this->display_field]) : $data[$this->display_field]; if ( ! empty($data[$this->display_field])) { - $crumbs[''] = character_limiter(strip_tags($data[$this->display_field]), 50); + $crumbs[''] = character_limiter(strip_tags($msg_data), 50); } $this->fuel->admin->set_titlebar($crumbs); @@ -1080,9 +1082,9 @@ function edit($id = NULL, $field = NULL, $redirect = TRUE) $this->fuel->admin->render($this->views['create_edit'], $vars, '', FUEL_FOLDER); // do this after rendering so it doesn't render current page' - if ( ! empty($data[$this->display_field]) AND $inline !== TRUE) + if ( ! empty($msg_data) AND $inline !== TRUE) { - $this->fuel->admin->add_recent_page($this->uri->uri_string(), $this->module_name.': '.$data[$this->display_field], $this->module); + $this->fuel->admin->add_recent_page($this->uri->uri_string(), $this->module_name.': '.$msg_data, $this->module); } } @@ -1156,7 +1158,8 @@ protected function _process_edit($id) // run after_save hook $this->_run_hook('after_save', $data); - $msg = lang('module_edited', $this->module_name, $data[$this->display_field]); + $msg_data = (is_array($data[$this->display_field])) ? json_encode($data[$this->display_field]) : $data[$this->display_field]; + $msg = lang('module_edited', $this->module_name, $msg_data); $this->fuel->logs->write($msg); $this->_clear_cache(); @@ -2086,7 +2089,8 @@ function _toggle($id, $field, $toggle) // run after_save hook $this->_run_hook('after_save', $data); - $msg = lang('module_edited', $this->module_name, $data[$this->display_field]); + $msg_data = (is_array($data[$this->display_field])) ? json_encode($data[$this->display_field]) : $data[$this->display_field]; + $msg = lang('module_edited', $this->module_name, $msg_data); $this->fuel->logs->write($msg); } else