PluginProbe
Packeta / 2.1
Packeta v2.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / Forms / StoredUntilFormFactory.php

StoredUntilFormFactory.php in Packeta 2.1, at src/Packetery/Module/Forms/StoredUntilFormFactory.php

51 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare( strict_types=1 );
4
5 namespace Packetery\Module\Forms;
6
7 use Packetery\Module\FormFactory;
8 use Packetery\Nette\Forms\Form;
9
10 class StoredUntilFormFactory {
11
12 /**
13 * Form factory.
14 *
15 * @var FormFactory
16 */
17 private $formFactory;
18
19 /**
20 * Constructor.
21 *
22 * @param FormFactory $formFactory Form factory.
23 */
24 public function __construct(
25 FormFactory $formFactory
26 ) {
27 $this->formFactory = $formFactory;
28 }
29
30 /**
31 * Creates stored until modal form.
32 *
33 * @param string $name Form name.
34 *
35 * @return Form
36 */
37 public function createForm( string $name ): Form {
38 $form = $this->formFactory->create( $name );
39 $form->addHidden( 'packet_id' );
40 $form->addText( 'packetery_stored_until', __( 'Planned dispatch', 'packeta' ) )
41 ->setHtmlAttribute( 'class', 'date-picker' )
42 ->setHtmlAttribute( 'autocomplete', 'off' )
43 ->setRequired( false )
44 ->setNullable();
45 $form->addSubmit( 'submit', __( 'Change', 'packeta' ) );
46 $form->addButton( 'cancel', __( 'Cancel', 'packeta' ) );
47
48 return $form;
49 }
50 }
51