/** * beforeSave is called before a model is saved. Returning false from a beforeSave callback * will abort the save operation. * * @param Model $model Model using this behavior * @return mixed False if the operation should abort. Any other result will continue. */ public function beforeSave(Model $model) { $settings = $this->settings[$model->alias]; foreach (array_keys($settings) as $field) { $options = $this->settings[$model->alias][$field] + array('show-body-only' => true); $model->data[$model->alias][$field] = LibTidy::execute($model->data[$model->alias][$field], $options); } return true; }
/** * Generate tided HTML code * * @param string $content * @return string modified content if avaible, otherwise origin content */ public function execute($content, $options = array()) { $options += $this->settings; return LibTidy::execute($content, $options); }