You are here

function slickgrid_editors::get_result in Slickgrid 7

Same name and namespace in other branches
  1. 7.2 plugins/editors/handler.class.php \slickgrid_editors::get_result()
1 call to slickgrid_editors::get_result()
slickgrid_editors::update in plugins/editors/handler.class.php
Do the actual update - passes the update to the plugin's process functions

File

plugins/editors/handler.class.php, line 95

Class

slickgrid_editors
Base class for export UI.

Code

function get_result() {

  // If items have been updated, reload the values from the view
  if (count($this->updated)) {
    $view = slickgrid_get_view($this->view, $this->display_id, array_keys($this->updated));
    foreach ($view->result as $count => $row) {
      if (isset($this->updated[$row->{$view->base_field}])) {
        $this->updated[$row->{$view->base_field}]['value'] = $view
          ->render_field($this->field_id, $count);
      }
    }
  }

  // Clear the message queue
  drupal_get_messages();

  // Add our own messages
  if ($count_updated = count($this->updated)) {
    drupal_set_message(format_plural($count_updated, 'One item was updated succesfully.', '@count items were updated succesfully.'));
  }
  if ($count_errors = count($this->errors)) {
    $message = format_plural($count_errors, 'Update failed: there was an error', 'Update failed: There were @count errors.');
    $message .= theme('item_list', array(
      'items' => $this->errors,
    ));
    drupal_set_message($message, 'error');
  }

  // Return array of data to be returned to the grid
  return array(
    'errors' => $this->errors,
    'updated' => $this->updated,
    'field_id' => $this->field_id,
    'op' => 'update',
  );
}