<?php

use Jet\MVC_View;
use JetStudio\Form_Field_Callable;
use JetStudio\Form_Renderer_Field_Input_Callable;

/**
 * @var MVC_View $this
 * @var Form_Renderer_Field_Input_Callable $r
 * @var Form_Field_Callable $field
 */
$r = $this->getRaw( 'renderer' );
$field = $r->getField();
$value = $field->getValue();

if( !$r->getBaseCssClasses() ) {
	$r->setBaseCssClass( 'form-control' );
}

if( $field->getLastErrorCode() ) {
	$r->addCustomCssClass( 'is-invalid' );
}

$class_placeholder = $field->_('class name');
if($field->getClassContext()) {
	$class_placeholder = $field->_('class name or self::class or this');
}

$method_placeholder = $field->_('method name');
?>

<div>
	<div class="input-group">
		<span class="input-group-prepend"><span class="input-group-text"> </span></span>
		<input <?=$r->renderTagAttributes()?> name="<?=$field->getTagNameValue()?>[class]" id="<?=$field->getId()?>_class" value="<?=$field->getValue_class()?>" placeholder="<?=$class_placeholder?>"/>
		<span class="input-group-prepend"><span class="input-group-text">::</span></span>
		<input <?=$r->renderTagAttributes()?> name="<?=$field->getTagNameValue()?>[method]" id="<?=$field->getId()?>_method" value="<?=$field->getValue_method()?>" placeholder="<?=$method_placeholder?>"/>
		<span class="input-group-append"><span class="input-group-text">( <?=$field->getMethodArguments()?> ):<?=$field->getMethodReturnType()?></span></span>
	</div>
</div>
