d8e82e73f178722d1e36611d40b3f20d07b0e95f
[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 * @since 3.1
18 */
19 class ContactOptionAddForm extends AbstractCustomOptionForm
20 {
21 /**
22 * @inheritDoc
23 */
24 public $action = 'add';
25
26 /**
27 * @inheritDoc
28 */
29 public $activeMenuItem = 'wcf.acp.menu.link.contact.settings';
30
31 /**
32 * @inheritDoc
33 */
34 public $neededModules = ['MODULE_CONTACT_FORM'];
35
36 /**
37 * @inheritDoc
38 */
39 public $neededPermissions = ['admin.contact.canManageContactForm'];
40
41 /**
42 * action class name
43 * @var string
44 */
45 public $actionClass = ContactOptionAction::class;
46
47 /**
48 * base class name
49 * @var string
50 */
51 public $baseClass = ContactOption::class;
52
53 /**
54 * editor class name
55 * @var string
56 */
57 public $editorClass = ContactOptionEditor::class;
58
59 /**
60 * @inheritDoc
61 */
62 public function readParameters()
63 {
64 parent::readParameters();
65
66 $this->getI18nValue('optionTitle')->setLanguageItem('wcf.contact.option', 'wcf.contact', 'com.woltlab.wcf');
67 $this->getI18nValue('optionDescription')->setLanguageItem(
68 'wcf.contact.optionDescription',
69 'wcf.contact',
70 'com.woltlab.wcf'
71 );
72 }
73
74 /**
75 * @inheritDoc
76 */
77 public function save()
78 {
79 parent::save();
80
81 WCF::getTPL()->assign([
82 'objectEditLink' => LinkHandler::getInstance()->getControllerLink(
83 ContactOptionEditForm::class,
84 ['id' => $this->objectAction->getReturnValues()['returnValues']->getObjectID()]
85 ),
86 ]);
87 }
88 }