/** * @return array */ protected function getFormFields() { $fields = ['title' => ['type' => 'text', 'cssclass' => 'mw-ck-title-input', 'label-message' => 'collaborationkit-createhub-title'], 'display_name' => ['type' => 'text', 'cssclass' => 'mw-ck-display-input', 'label-message' => 'collaborationkit-createhub-displayname'], 'icon' => ['type' => 'text', 'cssclass' => 'mw-ck-icon-input', 'label-message' => 'collaborationkit-createhub-image']]; // Colours for the hub styles $colours = []; foreach (CollaborationHubContent::getThemeColours() as $colour) { $colours['collaborationkit-' . $colour] = $colour; } $fields['colour'] = ['type' => 'select', 'cssclass' => 'mw-ck-colour-input', 'id' => 'wpCollabHubColour', 'label-message' => 'collaborationkit-createhub-colour', 'options' => $this->getOptions($colours), 'default' => 'blue5']; /* Comment this out until it's actually implemented (T135408) // Content source options $fields['content_source'] = [ 'type' => 'select', 'options' => $this->getOptions( [ 'collaborationkit-createhub-new' => 'new', 'collaborationkit-createhub-import' => 'import', 'collaborationkit-createhub-clone' => 'clone', ] ), 'default' => 'new', // might want to change default to clone from the default? (TODO add a canned default as example and stuff: T136470) 'label-message' => 'collaborationkit-createhub-content', 'cssclass' => 'mw-ck-source-options-input' ]; $fields['source'] = [ 'type' => 'text', 'label-message' => 'collaborationkit-createhub-source', 'hide-if' => [ '===', 'wpcontent_source', 'new' ], 'cssclass' => 'mw-ck-source-input' ]; */ $fields['introduction'] = ['type' => 'textarea', 'rows' => 5, 'label-message' => 'collaborationkit-createhub-introduction', 'cssclass' => 'mw-ck-introduction-input']; return $fields; }
/** * @param $parts array * @return array */ protected function getFormFields($parts) { $fields = ['display_name' => new OOUI\FieldLayout(new OOUI\TextInputWidget(['name' => 'wpCollabHubDisplayName', 'id' => 'wpCollabHubDisplayName', 'type' => 'text', 'cssclass' => 'mw-ck-displayinput', 'value' => $parts[0]]), ['label' => wfMessage('collaborationkit-hubedit-displayname')->text(), 'align' => 'top']), 'introduction' => new OOUI\FieldLayout(new OOUI\TextInputWidget(['multiline' => true, 'name' => 'wpCollabHubIntroduction', 'id' => 'wpCollabHubIntroduction', 'type' => 'textarea', 'rows' => 5, 'cssclass' => 'mw-ck-introductioninput', 'value' => $parts[1]]), ['label' => wfMessage('collaborationkit-hubedit-introduction')->text(), 'align' => 'top']), 'footer' => new OOUI\FieldLayout(new OOUI\TextInputWidget(['multiline' => true, 'name' => 'wpCollabHubFooter', 'id' => 'wpCollabHubFooter', 'type' => 'textarea', 'rows' => 5, 'cssclass' => 'mw-ck-introductioninput', 'value' => $parts[2]]), ['label' => wfMessage('collaborationkit-hubedit-footer')->text(), 'align' => 'top']), 'image' => new OOUI\FieldLayout(new OOUI\TextInputWidget(['name' => 'wpCollabHubImage', 'id' => 'wpCollabHubImage', 'type' => 'text', 'cssclass' => 'mw-ck-hubimageinput', 'value' => $parts[3]]), ['label' => wfMessage('collaborationkit-hubedit-image')->text(), 'align' => 'top'])]; // Colours for the hub styles $colours = []; foreach (CollaborationHubContent::getThemeColours() as $colour) { $colours['collaborationkit-' . $colour] = $colour; } if ($parts[4] == '') { $selectedColour = 'blue5'; } else { $selectedColour = $parts[4]; } $fields['colour'] = new OOUI\FieldLayout(new OOUI\DropdownInputWidget(['name' => 'wpCollabHubColour', 'id' => 'wpCollabHubColour', 'type' => 'select', 'options' => $this->getOptions($colours), 'class' => 'mw-ck-colourinput', 'value' => $selectedColour]), ['label' => wfMessage('collaborationkit-hubedit-colour')->text(), 'align' => 'top']); if ($parts[5] == '') { $includedContent = ''; } else { $includedContent = $parts[5]; } $fields['content'] = new OOUI\FieldLayout(new OOUI\TextInputWidget(['multiline' => true, 'name' => 'wpCollabHubContent', 'id' => 'wpCollabHubContent', 'type' => 'textarea', 'rows' => 10, 'class' => 'mw-ck-introductioninput', 'value' => $includedContent]), ['label' => wfMessage('collaborationkit-hubedit-content')->text(), 'align' => 'top']); return $fields; }