1 | <?php |
||
14 | class ImageFormFactory extends FileFormFactory |
||
15 | { |
||
16 | protected function getSpecsMarkup($record) |
||
30 | |||
31 | protected function getFormFieldAttributesTab($record, $context = []) |
||
32 | { |
||
33 | /** @var Tab $tab */ |
||
34 | $tab = parent::getFormFieldAttributesTab($record, $context); |
||
35 | |||
36 | $alignments = array( |
||
37 | 'leftAlone' => _t('AssetAdmin.AlignmentLeftAlone', 'On the left, on its own.'), |
||
38 | 'center' => _t('AssetAdmin.AlignmentCenter', 'Centered, on its own.'), |
||
39 | 'left' => _t('AssetAdmin.AlignmentLeft', 'On the left, with text wrapping around.'), |
||
40 | 'right' => _t('AssetAdmin.AlignmentRight', 'On the right, with text wrapping around.'), |
||
41 | ); |
||
42 | |||
43 | $tab->push( |
||
44 | DropdownField::create('Alignment', _t('AssetAdmin.Alignment', 'Alignment'), $alignments) |
||
45 | ); |
||
46 | $tab->push( |
||
47 | FieldGroup::create( |
||
48 | _t('AssetAdmin.ImageSpecs', 'Dimensions'), |
||
49 | TextField::create( |
||
50 | 'InsertWidth', |
||
51 | _t('AssetAdmin.ImageWidth', 'Width') |
||
52 | ) |
||
53 | ->setMaxLength(5) |
||
54 | ->addExtraClass('flexbox-area-grow'), |
||
55 | TextField::create( |
||
56 | 'InsertHeight', |
||
57 | _t('AssetAdmin.ImageHeight', 'Height') |
||
58 | ) |
||
59 | ->setMaxLength(5) |
||
60 | ->addExtraClass('flexbox-area-grow') |
||
61 | ) |
||
62 | ->addExtraClass('fieldgroup--fill-width') |
||
63 | ->setName('Dimensions') |
||
64 | ); |
||
65 | |||
66 | $tab->insertBefore( |
||
67 | 'Caption', |
||
68 | TextField::create('AltText', _t('AssetAdmin.AltText', 'Alternative text (alt)')) |
||
69 | ->setDescription(_t( |
||
70 | 'AssetAdmin.AltTextDescription', |
||
71 | 'Shown to screen readers or if image can\'t be displayed' |
||
72 | )) |
||
73 | ); |
||
74 | $tab->insertAfter( |
||
75 | 'AltText', |
||
76 | TextField::create('TitleTooltip', _t('AssetAdmin.TitleTooltip', 'Title text (tooltip)')) |
||
77 | ->setDescription(_t('AssetAdmin.TitleTooltipDescription', 'For additional information about the image')) |
||
78 | ->setValue($record->Title) |
||
79 | ); |
||
80 | |||
81 | return $tab; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @param Controller $controller |
||
86 | * @param string $name |
||
87 | * @param array $context |
||
88 | * @return Form |
||
89 | */ |
||
90 | public function getForm(Controller $controller, $name = FormFactory::DEFAULT_NAME, $context = []) |
||
127 | } |
||
128 |