Example #1
0
 /**
  * Caches Term in `terms` field
  *
  * @param Model model
  * @param array $data
  * @return void
  */
 public function cacheTerms(Model $model, &$data = null)
 {
     if ($data === null) {
         $data =& $model->data;
     }
     $taxonomyIds = $this->_getSelectedTerms($data);
     $taxonomies = $model->Taxonomy->find('all', array('conditions' => array('Taxonomy.id' => $taxonomyIds)));
     $terms = Hash::combine($taxonomies, '{n}.Term.id', '{n}.Term.slug');
     $data[$model->alias]['terms'] = $model->encodeData($terms, array('trim' => false, 'json' => true));
 }