Ejemplo n.º 1
0
 /**
  * Sets a template entity with the POSTed data and validates it, setting
  * an alert if there are any errors.
  *
  * @param TemplateModel $template A Template entity
  * @return mixed FALSE if nothing was posted, void if it was an AJAX call,
  *  or a ValidationResult object.
  */
 private function validateTemplate($template)
 {
     if (empty($_POST)) {
         return FALSE;
     }
     $template->set($_POST);
     $template->edit_date = ee()->localize->now;
     $template->last_author_id = ee()->session->userdata('member_id');
     $result = $template->validate();
     if ($response = $this->ajaxValidation($result)) {
         ee()->output->send_ajax_response($response);
     }
     if ($result->failed()) {
         ee('CP/Alert')->makeInline('shared-form')->asIssue()->withTitle(lang('update_template_error'))->addToBody(lang('update_template_error_desc'))->now();
     }
     return $result;
 }