Fix issues with user profile menu PIP GUI
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 12:55:54 +0000 (14:55 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 12:55:54 +0000 (14:55 +0200)
See #2545

com.woltlab.wcf/tmp_userProfileMenu.xml [new file with mode: 0644]
wcfsetup/install/files/lib/system/package/plugin/UserProfileMenuPackageInstallationPlugin.class.php

diff --git a/com.woltlab.wcf/tmp_userProfileMenu.xml b/com.woltlab.wcf/tmp_userProfileMenu.xml
new file mode 100644 (file)
index 0000000..c3afcbc
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<data xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/vortex/userProfileMenu.xsd" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       <import>
+               <userprofilemenuitem name="recentActivity">
+                       <classname>wcf\system\menu\user\profile\content\RecentActivityUserProfileMenuContent</classname>
+                       <showorder>1</showorder>
+               </userprofilemenuitem>
+               <userprofilemenuitem name="wall">
+                       <classname>wcf\system\menu\user\profile\content\CommentUserProfileMenuContent</classname>
+                       <showorder>1</showorder>
+                       <options>module_user_profile_wall</options>
+               </userprofilemenuitem>
+               <userprofilemenuitem name="likes">
+                       <classname>wcf\system\menu\user\profile\content\LikesUserProfileMenuContent</classname>
+                       <options>module_like</options>
+                       <showorder>2</showorder>
+               </userprofilemenuitem>
+               <userprofilemenuitem name="about">
+                       <classname>wcf\system\menu\user\profile\content\AboutUserProfileMenuContent</classname>
+                       <showorder>3</showorder>
+               </userprofilemenuitem>
+       </import>
+</data>
index 275a1f6d4d5b1546f81189fffb0f02ee5818bf6f..f15da67517919cccef7db6e7e122191d2ac4c294 100644 (file)
@@ -115,16 +115,17 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall
                $dataContainer = $form->getNodeById('data');
                
                $dataContainer->appendChildren([
-                       TextFormField::create('name')
-                               ->label('wcf.acp.pip.userProfileMenu.name')
-                               ->description('wcf.acp.pip.userProfileMenu.name.description')
+                       TextFormField::create('menuItem')
+                               ->objectProperty('name')
+                               ->label('wcf.acp.pip.userProfileMenu.eventName')
+                               ->description('wcf.acp.pip.userProfileMenu.eventName.description')
                                ->required()
                                ->addValidator(new FormFieldValidator('format', function(TextFormField $formField) {
                                        if (!preg_match('~^[a-z][A-z]+$~', $formField->getValue())) {
                                                $formField->addValidationError(
                                                        new FormFieldValidationError(
                                                                'format',
-                                                               'wcf.acp.pip.userProfileMenu.name.error.format'
+                                                               'wcf.acp.pip.userProfileMenu.menuItem.error.format'
                                                        )
                                                );
                                        }
@@ -138,7 +139,7 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall
                                                        $formField->addValidationError(
                                                                new FormFieldValidationError(
                                                                        'notUnique',
-                                                                       'wcf.acp.pip.userProfileMenu.name.error.notUnique'
+                                                                       'wcf.acp.pip.userProfileMenu.menuItem.error.notUnique'
                                                                )
                                                        );
                                                }
@@ -219,8 +220,8 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall
         */
        protected function setEntryListKeys(IDevtoolsPipEntryList $entryList) {
                $entryList->setKeys([
-                       'name' => 'wcf.acp.pip.userProfileMenu.name',
-                       'className' => 'wcf.acp.pip.userProfileMenu.className'
+                       'menuItem' => 'wcf.acp.pip.userProfileMenu.menuItem',
+                       'className' => 'wcf.form.field.className'
                ]);
        }
        
@@ -265,7 +266,7 @@ class UserProfileMenuPackageInstallationPlugin extends AbstractXMLPackageInstall
                
                $userProfileMenuItem = $document->createElement('userprofilemenuitem');
                $userProfileMenuItem->setAttribute('name', $data['name']);
-               $userProfileMenuItem->appendChild($document->createElement('classname', $data['className']));
+               $userProfileMenuItem->appendChild($document->createElement('classname', $data['classname']));
                
                foreach (['options', 'permissions', 'showorder'] as $optionalElement) {
                        if (!empty($data[$optionalElement])) {