<?php

namespace JetApplicationModule\Admin\Content\Images;

use Jet\UI;
use Jet\Form;
use Jet\Form_Renderer;
use Jet\MVC_View;

use JetApplication\Content_Gallery;

/**
 * @var MVC_View $this
 * @var Form $edit_form
 */

$edit_form = $this->getRaw( 'edit_form' );

$edit_form->renderer()->setDefaultLabelWidth(
	[
		Form_Renderer::LJ_SIZE_SMALL => 3,
		Form_Renderer::LJ_SIZE_MEDIUM => 3,
	]
);
$edit_form->renderer()->setDefaultFieldWidth(
	[
		Form_Renderer::LJ_SIZE_SMALL => 8,
		Form_Renderer::LJ_SIZE_MEDIUM => 8
	]
);

echo $edit_form->start();

foreach( Content_Gallery::getLocales() as $locale ):
	$field = $edit_form->field( '/localized/' . $locale . '/title' );

	echo $field->row()->start();
	?>
	<label for="<?= $field->getId() ?>"
	       class="col-md-2 col-form-label"><?= UI::flag( $locale ) ?> <?= $locale->getLanguageName() ?></label>
	<?php

	echo $field->container()->start();
	echo $field->input();
	echo $field->error();
	echo $field->container()->end();

	echo $field->row()->end();

endforeach;

echo $edit_form->end();
