<commit_before><?php

	trait RenderableFields
	{
		protected function renderFields()
		{
			return implode("", array_map(
				function($field) {
					$renderer = $field->getRenderer($this);
					
					return $renderer->getParam("row") ?
						$this->renderRow($renderer) :
						$renderer->render();
				},
				$this->getField()->getOrderedChildren()
			));
		}
		
		protected function renderRow($renderer)
		{
			return $this->tag(
				"div",
				$this->renderField($renderer),
				array("class" => "row")
			);
		}
		
		protected function renderField($renderer)
		{
			return
				$this->renderLabel($renderer) .
				$renderer->render() .
				$this->renderErrors($renderer);
		}
		
		protected function renderLabel($renderer)
		{
			return $renderer->getParam("label") ?
				$this->tag(
					"label",
					$renderer->getParam("label"),
					array("for" => $renderer->getId())
				) :
				"";
		}
		
		protected function renderErrors($renderer)
		{
			$errors = $renderer->getField()->getErrors();
			return count($errors) > 0 ?
				$this->tag(
					"div",
					implode("",
						array_map(function($error) {
						return $this->tag("div", $error, array("class" => "error"));
						}, $errors)
					),
					array("class" => "errors")
				) :
				"";
		}
	}<commit_msg>Implemented help label rendering for form fields.<commit_after><?php

	trait RenderableFields
	{
		protected function renderFields()
		{
			return implode("", array_map(
				function($field) {
					$renderer = $field->getRenderer($this);
					
					return $renderer->getParam("row") ?
						$this->renderRow($renderer) :
						$renderer->render();
				},
				$this->getField()->getOrderedChildren()
			));
		}
		
		protected function renderRow($renderer)
		{
			return $this->tag(
				"div",
				$this->renderField($renderer),
				array("class" => "row")
			);
		}
		
		protected function renderField($renderer)
		{
			return
				$this->renderLabel($renderer) .
				$renderer->render() .
				$this->renderErrors($renderer) .
				$this->renderHelp($renderer);
		}
		
		protected function renderLabel($renderer)
		{
			return $renderer->getParam("label") ?
				$this->tag(
					"label",
					$renderer->getParam("label"),
					array("for" => $renderer->getId())
				) :
				"";
		}
		
		protected function renderErrors($renderer)
		{
			$errors = $renderer->getField()->getErrors();
			return count($errors) > 0 ?
				$this->tag(
					"div",
					implode("",
						array_map(function($error) {
						return $this->tag("div", $error, array("class" => "error"));
						}, $errors)
					),
					array("class" => "errors")
				) :
				"";
		}
		
		protected function renderHelp($renderer)
		{
			return $renderer->getParam("help") ?
				$this->tag(
					"div",
					$renderer->getParam("help"),
					array("class" => "help")
				) :
				"";
		}
	}
{'fraction_non_alphanumeric': 0.18689925240299038, 'fraction_numerical': 0.000711997152011392, 'mean_word_length': 2.8024357239512856, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 56, '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': '5006538', 'n_tokens_mistral': 1226, 'n_tokens_neox': 924, 'n_words': 143}