<commit_before>	<?php /* _____DisplayField */ 
	if (!$this->model instanceof Garp_Spawn_Model_Abstract):
		throw new Exception('This partial requires a Garp_Spawn_Model_Base instance as $model parameter.');
	endif;
	
	$model 					= $this->model;

	$nameIsMandatory = function() use ($model) {
		$nameFieldSet = $model->fields->getFields('name', 'name');
		if (!$nameFieldSet) {
			return false;
		}
		
		$nameField = current($nameFieldSet);
		return $nameField->required;
	};
	
	$hasMandatoryName = $nameIsMandatory();
	
	$hasFirstAndLastName	= $this->spawnJs()->modelHasFirstAndLastName($model);

	$printFieldGetter		= function($fieldName) use ($model) {
		$defaultLanguage	= Garp_I18n::getDefaultLocale();
		$isMultilingual		= $model->fields->getField($fieldName)->isMultilingual();
		$postfix			= $isMultilingual ? '.' . $defaultLanguage : '';
 		$getter				= "rec.get('{$fieldName}')" . $postfix;

		return $getter;
	};
	
	$printListFieldGetters	= function() use ($model, $printFieldGetter) {
		$getters = array();
		foreach ($model->fields->listFieldNames as $fieldName) {
			$getters[] = $printFieldGetter($fieldName);
		}
		
		return implode(', ', $getters);
	} 
	
	?>
	displayFieldRenderer: function(rec){
	<?php if ($hasFirstAndLastName): ?>
		return rec.get('first_name') ? (rec.get('first_name') + (rec.get('last_name_prefix') ? ' ' + rec.get('last_name_prefix') + ' ' : ' ') + (rec.get('last_name') || '')) : __('New');
	<?php elseif ($hasMandatoryName): ?>
		return <?php echo $printFieldGetter('name') ?> || __('New');
	<?php else: ?>
		var out = [<?php echo $printListFieldGetters() ?>].join(" ").replace("  ", " "); 
		if (!out || out === ' ') {
			out = __("New");
		}
		return  out;
	<?php endif; ?>
	}<commit_msg>Better New label for creating records<commit_after>	<?php /* _____DisplayField */
	if (!$this->model instanceof Garp_Spawn_Model_Abstract):
		throw new Exception('This partial requires a Garp_Spawn_Model_Base instance as $model parameter.');
	endif;

	$model 					= $this->model;

	$nameIsMandatory = function() use ($model) {
		$nameFieldSet = $model->fields->getFields('name', 'name');
		if (!$nameFieldSet) {
			return false;
		}

		$nameField = current($nameFieldSet);
		return $nameField->required;
	};

	$hasMandatoryName = $nameIsMandatory();

	$hasFirstAndLastName	= $this->spawnJs()->modelHasFirstAndLastName($model);

	$printFieldGetter		= function($fieldName) use ($model) {
		$defaultLanguage	= Garp_I18n::getDefaultLocale();
		$isMultilingual		= $model->fields->getField($fieldName)->isMultilingual();
		$postfix			= $isMultilingual ? '.' . $defaultLanguage : '';
 		$getter				= "rec.get('{$fieldName}')" . $postfix;

		return $getter;
	};

	$printListFieldGetters	= function() use ($model, $printFieldGetter) {
		$getters = array();
		foreach ($model->fields->listFieldNames as $fieldName) {
			$getters[] = $printFieldGetter($fieldName);
		}

		return implode(', ', $getters);
	}

	?>
	displayFieldRenderer: function(rec){
	<?php if ($hasFirstAndLastName): ?>
		return rec.get('first_name') ? (rec.get('first_name') + (rec.get('last_name_prefix') ? ' ' + rec.get('last_name_prefix') + ' ' : ' ') + (rec.get('last_name') || '')) : __('New');
	<?php elseif ($hasMandatoryName): ?>
		return <?php echo $printFieldGetter('name') ?> || __('New');
	<?php else: ?>
		var out = [<?php echo $printListFieldGetters() ?>].join(" ").replace("  ", " ");
		if (!Ext.util.Format.trim(out)) {
			out = __("New");
		}
		return  out;
	<?php endif; ?>
	}
{'fraction_non_alphanumeric': 0.19638242894056848, 'fraction_numerical': 0.0011484352569623888, 'mean_word_length': 4.711475409836066, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3230093', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1217, 'n_words': 224}