Model/Behavior/DetailableBehavior.php
public function details(Model $Model, $queryData = null, $schema = false, $format = true) {
		$DetailModel = ClassRegistry::init($this->settings[$Model->alias]['alias']);

		if (is_string($queryData)) {
			$queryData = array('section' => $queryData);
		}

		$conditions = array($DetailModel->alias . '.foreign_key' => $Model->getID());
		if (!empty($queryData['section'])) {
			$section = $queryData['section'];
			$conditions[$DetailModel->alias . '.field LIKE'] = $section . '.%';
			unset($queryData['section']);
		}
		if (!empty($queryData['conditions'])) {
			$queryData['conditions'] = Hash::merge($conditions, $queryData['conditions']);
		}

		$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.value', $DetailModel->alias . '.label', 'foreign_key', 'foreign_model');
		if ($schema) {
			$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.input', $DetailModel->alias . '.data_type', $DetailModel->alias . '.label');
		}

		$order = array('position' => 'ASC');
		$recursive = -1;

		$results = $DetailModel->find('all', array_merge(compact('conditions', 'fields', 'order', 'recursive'), $queryData));

		return $this->detailsExtractSections($Model, $results, $section, $schema, $format);
	}
public function details(Model $Model, $queryData = null, $schema = false, $format = true) {
		$DetailModel = ClassRegistry::init($this->settings[$Model->alias]['alias']);

		if (is_string($queryData)) {
			$queryData = array('section' => $queryData);
		}

		$conditions = array($DetailModel->alias . '.foreign_key' => $Model->getID());
		if (!empty($queryData['section'])) {
			$section = $queryData['section'];
			$conditions[$DetailModel->alias . '.field LIKE'] = $section . '.%';
			unset($queryData['section']);
		}
		if (!empty($queryData['conditions'])) {
			$queryData['conditions'] = Hash::merge($conditions, $queryData['conditions']);
		}

		$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.value', $DetailModel->alias . '.label', 'foreign_key', 'foreign_model');
		if ($schema) {
			$fields = array($DetailModel->alias . '.field', $DetailModel->alias . '.input', $DetailModel->alias . '.data_type', $DetailModel->alias . '.label');
		}

		$order = array('position' => 'ASC');
		$recursive = -1;

		$results = $DetailModel->find('all', array_merge(compact('conditions', 'fields', 'order', 'recursive'), $queryData));

		return $this->detailsExtractSections($Model, $results, $section, $schema, $format);
	}
public function details ( Model $ Model , $ queryData = null , $ schema = false , $ format = true ) { $ DetailModel = ClassRegistry :: init ( $ this -> settings [ $ Model -> alias ] [ 'alias' ] ) ; if ( is_string ( $ queryData ) ) { $ queryData = array ( 'section' => $ queryData ) ; } $ conditions = array ( $ DetailModel -> alias . '.foreign_key' => $ Model -> getID ( ) ) ; if ( ! empty ( $ queryData [ 'section' ] ) ) { $ section = $ queryData [ 'section' ] ; $ conditions [ $ DetailModel -> alias . '.field LIKE' ] = $ section . '.%' ; unset ( $ queryData [ 'section' ] ) ; } if ( ! empty ( $ queryData [ 'conditions' ] ) ) { $ queryData [ 'conditions' ] = Hash :: merge ( $ conditions , $ queryData [ 'conditions' ] ) ; } $ fields = array ( $ DetailModel -> alias . '.field' , $ DetailModel -> alias . '.value' , $ DetailModel -> alias . '.label' , 'foreign_key' , 'foreign_model' ) ; if ( $ schema ) { $ fields = array ( $ DetailModel -> alias . '.field' , $ DetailModel -> alias . '.input' , $ DetailModel -> alias . '.data_type' , $ DetailModel -> alias . '.label' ) ; } $ order = array ( 'position' => 'ASC' ) ; $ recursive = - 1 ; $ results = $ DetailModel -> find ( 'all' , array_merge ( compact ( 'conditions' , 'fields' , 'order' , 'recursive' ) , $ queryData ) ) ; return $ this -> detailsExtractSections ( $ Model , $ results , $ section , $ schema , $ format ) ; }
Custom method to find all attached details or by section.

@param Model $model Model to query.
@param string $func
@param string $state Either "before" or "after"
@param array $query
@param array $result
@return array
Custom method to find all attached details or by section .