Skip to content

Commit

Permalink
fixes for if the data being saved for a display_field is an array
Browse files Browse the repository at this point in the history
  • Loading branch information
daylightstudio committed Oct 1, 2015
1 parent bdd1b22 commit 984e09a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions fuel/modules/fuel/controllers/module.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 984e09a

Please sign in to comment.