Skip to content

Commit

Permalink
Pimcore 11 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Nov 7, 2023
1 parent 3cecc51 commit 673cb31
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeception.yml
Expand Up @@ -20,7 +20,7 @@ jobs:
APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://test:test@127.0.0.1:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes/DataObject"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,5 +1,5 @@
# License
Copyright (C) 2022 DACHCOM.DIGITAL
Copyright (C) 2023 DACHCOM.DIGITAL

This software is available under the GNU General Public License version 3 (GPLv3).

Expand Down
4 changes: 4 additions & 0 deletions config/services/eventlistener.yaml
Expand Up @@ -5,6 +5,10 @@ services:
autoconfigure: true
public: false

SocialDataBundle\EventListener\Admin\AssetListener:
tags:
- { name: kernel.event_subscriber }

SocialDataBundle\EventListener\FeedPostListener:
tags:
- { name: kernel.event_subscriber }
Expand Down
54 changes: 24 additions & 30 deletions public/js/plugin.js
@@ -1,34 +1,27 @@
pimcore.registerNS('pimcore.plugin.SocialData');
class SocialDataCore {

pimcore.plugin.SocialData = Class.create(pimcore.plugin.admin, {
constructor() {

getClassName: function () {
return 'pimcore.plugin.SocialData';
},
if (String.prototype.format) {
return;
}

initialize: function () {
pimcore.plugin.broker.registerPlugin(this);
String.prototype.format = function () {

if (!String.prototype.format) {
String.prototype.format = function () {
var args = arguments;
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}
},
let args = arguments;

uninstall: function () {
// void
},
return this.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
}

pimcoreReady: function (params, broker) {
init() {

var subMenu = [],
let subMenu = [],
user = pimcore.globalmanager.get('user');

if (user.isAllowed('social_data_bundle_menu_settings')) {
Expand Down Expand Up @@ -61,24 +54,25 @@ pimcore.plugin.SocialData = Class.create(pimcore.plugin.admin, {
}
});
}
},
}

openSettingsPanel: function () {
openSettingsPanel() {
try {
pimcore.globalmanager.get('social_data_bundle_settings').activate();
} catch (e) {
pimcore.globalmanager.add('social_data_bundle_settings', new SocialData.SettingsPanel());
}
},
}

openWallsPanel: function () {
openWallsPanel() {
try {
pimcore.globalmanager.get('social_data_bundle_walls').activate();
} catch (e) {
pimcore.globalmanager.add('social_data_bundle_walls', new SocialData.WallsPanel());
}
}
}

});
const socialDataCoreHandler = new SocialDataCore();

new pimcore.plugin.SocialData();
document.addEventListener(pimcore.events.pimcoreReady, socialDataCoreHandler.init.bind(socialDataCoreHandler));
6 changes: 1 addition & 5 deletions src/Command/FetchSocialPostsCommand.php
Expand Up @@ -13,12 +13,8 @@ class FetchSocialPostsCommand extends Command
protected static $defaultName = 'social-data:fetch:social-posts';
protected static $defaultDescription = 'Fetch Social Posts';

protected SocialPostBuilderProcessor $socialPostBuilderProcessor;

public function __construct(SocialPostBuilderProcessor $socialPostBuilderProcessor)
public function __construct(protected SocialPostBuilderProcessor $socialPostBuilderProcessor)
{
$this->socialPostBuilderProcessor = $socialPostBuilderProcessor;

parent::__construct();
}

Expand Down
41 changes: 41 additions & 0 deletions src/EventListener/Admin/AssetListener.php
@@ -0,0 +1,41 @@
<?php

namespace SocialDataBundle\EventListener\Admin;

use Pimcore\Event\BundleManager\PathsEvent;
use Pimcore\Event\BundleManagerEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class AssetListener implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
BundleManagerEvents::CSS_PATHS => 'addCssFiles',
BundleManagerEvents::JS_PATHS => 'addJsFiles',
];
}

public function addCssFiles(PathsEvent $event): void
{
$event->addPaths([
'/bundles/socialdata/css/admin.css'
]);
}

public function addJsFiles(PathsEvent $event): void
{
$event->addPaths([
'/bundles/socialdata/js/component/relation.js',
'/bundles/socialdata/js/component/relationTextField.js',
'/bundles/socialdata/js/component/connectWindow.js',
'/bundles/socialdata/js/plugin.js',
'/bundles/socialdata/js/settingsPanel.js',
'/bundles/socialdata/js/wallsPanel.js',
'/bundles/socialdata/js/wall/mainPanel.js',
'/bundles/socialdata/js/connector/abstract-connector.js',
'/bundles/socialdata/js/feed/abstract-feed.js',
'/bundles/socialdata/js/vendor/dataObject.js',
]);
}
}
23 changes: 0 additions & 23 deletions src/SocialDataBundle.php
Expand Up @@ -48,29 +48,6 @@ protected function configureDoctrineExtension(ContainerBuilder $container): void
);
}

public function getCssPaths(): array
{
return [
'/bundles/socialdata/css/admin.css'
];
}

public function getJsPaths(): array
{
return [
'/bundles/socialdata/js/component/relation.js',
'/bundles/socialdata/js/component/relationTextField.js',
'/bundles/socialdata/js/component/connectWindow.js',
'/bundles/socialdata/js/plugin.js',
'/bundles/socialdata/js/settingsPanel.js',
'/bundles/socialdata/js/wallsPanel.js',
'/bundles/socialdata/js/wall/mainPanel.js',
'/bundles/socialdata/js/connector/abstract-connector.js',
'/bundles/socialdata/js/feed/abstract-feed.js',
'/bundles/socialdata/js/vendor/dataObject.js',
];
}

protected function getNamespaceName(): string
{
return 'SocialDataBundle\Model';
Expand Down

0 comments on commit 673cb31

Please sign in to comment.