Apply PSR-12 code style (#3886)
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / acp / form / ContactOptionAddForm.class.php
1 <?php
2
3 namespace wcf\acp\form;
4
5 use wcf\data\contact\option\ContactOption;
6 use wcf\data\contact\option\ContactOptionAction;
7 use wcf\data\contact\option\ContactOptionEditor;
8 use wcf\system\request\LinkHandler;
9 use wcf\system\WCF;
10
11 /**
12 * Shows the contact option add form.
13 *
14 * @author Alexander Ebert
15 * @copyright 2001-2019 WoltLab GmbH
16 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
17 * @package WoltLabSuite\Core\Acp\Form
18 * @since 3.1
19 */
20 class ContactOptionAddForm extends AbstractCustomOptionForm
21 {
22 /**
23 * @inheritDoc
24 */
25 public $action = 'add';
26
27 /**
28 * @inheritDoc
29 */
30 public $activeMenuItem = 'wcf.acp.menu.link.contact.settings';
31
32 /**
33 * @inheritDoc
34 */
35 public $neededModules = ['MODULE_CONTACT_FORM'];
36
37 /**
38 * @inheritDoc
39 */
40 public $neededPermissions = ['admin.contact.canManageContactForm'];
41
42 /**
43 * action class name
44 * @var string
45 */
46 public $actionClass = ContactOptionAction::class;
47
48 /**
49 * base class name
50 * @var string
51 */
52 public $baseClass = ContactOption::class;
53
54 /**
55 * editor class name
56 * @var string
57 */
58 public $editorClass = ContactOptionEditor::class;
59
60 /**
61 * @inheritDoc
62 */
63 public function readParameters()
64 {
65 parent::readParameters();
66
67 $this->getI18nValue('optionTitle')->setLanguageItem('wcf.contact.option', 'wcf.contact', 'com.woltlab.wcf');
68 $this->getI18nValue('optionDescription')->setLanguageItem(
69 'wcf.contact.optionDescription',
70 'wcf.contact',
71 'com.woltlab.wcf'
72 );
73 }
74
75 /**
76 * @inheritDoc
77 */
78 public function save()
79 {
80 parent::save();
81
82 WCF::getTPL()->assign([
83 'objectEditLink' => LinkHandler::getInstance()->getControllerLink(
84 ContactOptionEditForm::class,
85 ['id' => $this->objectAction->getReturnValues()['returnValues']->getObjectID()]
86 ),
87 ]);
88 }
89 }