Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpublished documents are not shown in tree and greed view #774

Open
mhgtlc opened this issue Dec 2, 2024 · 3 comments
Open

Unpublished documents are not shown in tree and greed view #774

mhgtlc opened this issue Dec 2, 2024 · 3 comments

Comments

@mhgtlc
Copy link
Contributor

mhgtlc commented Dec 2, 2024

Unpublished documents are not shown in tree view

I was able to fix that by having a subscriber:

public function objectListBeforeListLoad(GenericEvent $event)
    {
        $list = $event->getArgument("list");
        if ($list instanceof DataObject\Listing && !$list->getUnpublished()) {
            $list->setUnpublished(true);
            $event->setArgument("list", $list);
        }
    }

    public static function getSubscribedEvents(): array
    {
        return [
            AdminEvents::OBJECT_LIST_BEFORE_LIST_LOAD => 'objectListBeforeListLoad',
    ];
}

that event is being dispatched in:
/src/Controller/Admin/DataObject/DataObjectActionsTrait.php lines: 105-115:
https://github.com/pimcore/admin-ui-classic-bundle/blob/1.6/src/Controller/Admin/DataObject/DataObjectActionsTrait.php#L112

$list = $gridHelperService->prepareListingForGrid($allParams, $requestedLanguage, $this->getAdminUser());

            if ($objectType === DataObject::OBJECT_TYPE_OBJECT) {
                $beforeListLoadEvent = new GenericEvent($this, [
                    'list' => $list,
                    'context' => $allParams,
                ]);
                $eventDispatcher->dispatch($beforeListLoadEvent, AdminEvents::OBJECT_LIST_BEFORE_LIST_LOAD);
                /** @var DataObject\Listing\Concrete $list */
                $list = $beforeListLoadEvent->getArgument('list');
            }

and if you look in /src/Helper/GridHelperService.php line 514, method :

public function prepareListingForGrid(array $requestParams, string $requestedLanguage, User $adminUser): DataObject\Listing\Concrete

https://github.com/pimcore/admin-ui-classic-bundle/blob/1.6/src/Helper/GridHelperService.php#L514
you can see that list does NOT set $list->setUnpublished(true);
but it should also allow unpublished records, because we can filter by it in grid view:
Image

@brusch

Copy link

Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

@mhgtlc
Copy link
Contributor Author

mhgtlc commented Dec 27, 2024

@brusch @robertSt7 can you please check this issue?

@fashxp
Copy link
Member

fashxp commented Jan 2, 2025

Hi,
I cannot reproduce that.
Unpublished documents are shown in tree in the demo ... and there is no grid for documents.
Image

Please share more information ... or even better, provide a fix for that ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants