Model/CommonAppModel.php
public static function getForeignModelDisplayField($model, $foreignModel, $path = false) {
		$_this = ClassRegistry::init($model);
		$displayField = $_this->displayField;

		if (is_bool($foreignModel)) {
			$path = $foreignModel;
			list(, $name) = pluginSplit($model);
		} else {
			list(, $name) = pluginSplit($foreignModel);
			foreach (array_keys($_this->belongsToForeignModels) as $model) {
				if ($name == $model) {
					$displayField = $_this->{$model}->displayField;
					break;
				}
			}
		}

		if (true === $path || (false !== $path && empty($path))) {
			$displayField = "$name.$displayField";
		} else if (false !== $path) {
			$displayField = "$path.$name.$displayField";
		}

		return $displayField;
	}
public static function getForeignModelDisplayField($model, $foreignModel, $path = false) {
		$_this = ClassRegistry::init($model);
		$displayField = $_this->displayField;

		if (is_bool($foreignModel)) {
			$path = $foreignModel;
			list(, $name) = pluginSplit($model);
		} else {
			list(, $name) = pluginSplit($foreignModel);
			foreach (array_keys($_this->belongsToForeignModels) as $model) {
				if ($name == $model) {
					$displayField = $_this->{$model}->displayField;
					break;
				}
			}
		}

		if (true === $path || (false !== $path && empty($path))) {
			$displayField = "$name.$displayField";
		} else if (false !== $path) {
			$displayField = "$path.$name.$displayField";
		}

		return $displayField;
	}
public static function getForeignModelDisplayField ( $ model , $ foreignModel , $ path = false ) { $ _this = ClassRegistry :: init ( $ model ) ; $ displayField = $ _this -> displayField ; if ( is_bool ( $ foreignModel ) ) { $ path = $ foreignModel ; list ( , $ name ) = pluginSplit ( $ model ) ; } else { list ( , $ name ) = pluginSplit ( $ foreignModel ) ; foreach ( array_keys ( $ _this -> belongsToForeignModels ) as $ model ) { if ( $ name == $ model ) { $ displayField = $ _this -> { $ model } -> displayField ; break ; } } } if ( true === $ path || ( false !== $ path && empty ( $ path ) ) ) { $ displayField = "$name.$displayField" ; } else if ( false !== $ path ) { $ displayField = "$path.$name.$displayField" ; } return $ displayField ; }
Gets the foreign model's display field. Useful in views.

@param string $foreignModel Model's name (i.e. 'Model' or 'Plugin.Model').
@param boolean $path Return the array's path to the display field in the data
array or just the display field.
@return string
Gets the foreign model s display field . Useful in views .