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

View page button in PageAdmin with multisite #1744

Open
haivala opened this issue Jan 8, 2024 · 6 comments
Open

View page button in PageAdmin with multisite #1744

haivala opened this issue Jan 8, 2024 · 6 comments

Comments

@haivala
Copy link
Contributor

haivala commented Jan 8, 2024

Environment

Sonata packages

show

$ composer show --latest 'sonata-project/*'
Direct dependencies required in composer.json:
sonata-project/admin-bundle              4.29.2 4.29.2 The missing Symfony Admin Generator
sonata-project/doctrine-orm-admin-bundle 4.15.0 4.15.0 Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/formatter-bundle          5.3.0  5.3.0  Symfony SonataFormatterBundle
sonata-project/media-bundle              4.11.0 4.11.0 Symfony SonataMediaBundle
sonata-project/page-bundle               4.7.1  4.7.1  This bundle provides a Site and Page management through container and block services

Transitive dependencies not required in composer.json:
sonata-project/block-bundle              5.1.0  5.1.0  Symfony SonataBlockBundle
sonata-project/doctrine-extensions       2.3.0  2.3.0  Doctrine2 behavioral extensions
sonata-project/exporter                  3.3.0  3.3.0  Lightweight Exporter library
sonata-project/form-extensions           2.3.0  2.3.0  Symfony form extensions
sonata-project/seo-bundle                3.8.0  3.8.0  Symfony SonataSeoBundle
sonata-project/twig-extensions           2.4.0  2.4.0  Sonata twig extensions

Symfony packages

show

$ composer show --latest 'symfony/*'
Direct dependencies required in composer.json:
symfony/asset                      v6.4.0  v7.0.0  Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/console                    v6.4.2  v7.0.2  Eases the creation of beautiful and testable command line interfaces
symfony/debug-bundle               v6.4.0  v7.0.0  Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony f...
symfony/doctrine-messenger         v6.4.2  v7.0.2  Symfony Doctrine Messenger Bridge
symfony/dotenv                     v6.4.2  v7.0.2  Registers environment variables from a .env file
symfony/flex                       v2.4.3  v2.4.3  Composer plugin for Symfony
symfony/framework-bundle           v6.4.2  v7.0.2  Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                v6.4.2  v7.0.2  Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/mailer                     v6.4.2  v7.0.2  Helps sending emails
symfony/maker-bundle               v1.52.0 v1.52.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boile...
symfony/messenger                  v6.4.0  v7.0.1  Helps applications send and receive messages to/from other applications or via message queues
symfony/monolog-bridge             v6.4.0  v7.0.0  Provides integration for Monolog with various Symfony components
symfony/monolog-bundle             v3.10.0 v3.10.0 Symfony MonologBundle
symfony/security-bundle            v6.4.2  v7.0.2  Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/stopwatch                  v6.4.0  v7.0.0  Provides a way to profile code
symfony/ux-lazy-image              v2.13.2 v2.13.2 Lazy image loader and utilities for Symfony
symfony/ux-turbo                   v2.13.2 v2.13.2 Hotwire Turbo integration for Symfony
symfony/web-link                   v6.4.0  v7.0.0  Manages links between resources
symfony/web-profiler-bundle        v6.4.2  v7.0.2  Provides a development tool that gives detailed information about the execution of any request
symfony/webpack-encore-bundle      v2.1.1  v2.1.1  Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v6.4.0  v7.0.0  Loads and dumps YAML files

Transitive dependencies not required in composer.json:
symfony/cache                      v7.0.2  v7.0.2  Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts            v3.4.0  v3.4.0  Generic abstractions related to caching
symfony/clock                      v7.0.2  v7.0.2  Decouples applications from the system clock
symfony/config                     v6.4.0  v7.0.0  Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/dependency-injection       v6.4.2  v7.0.2  Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts      v3.4.0  v3.4.0  A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge            v7.0.2  v7.0.2  Provides integration for Doctrine with various Symfony components
symfony/error-handler              v7.0.0  v7.0.0  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v6.4.2  v7.0.2  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v3.4.0  v3.4.0  Generic abstractions related to dispatching event
symfony/expression-language        v6.4.2  v7.0.2  Provides an engine that can compile and evaluate expressions
symfony/filesystem                 v7.0.0  v7.0.0  Provides basic utilities for the filesystem
symfony/finder                     v7.0.0  v7.0.0  Finds files and directories via an intuitive fluent interface
symfony/form                       v6.4.1  v7.0.1  Allows to easily create, process and reuse HTML forms
symfony/http-client-contracts      v3.4.0  v3.4.0  Generic abstractions related to HTTP clients
symfony/http-foundation            v6.4.2  v7.0.0  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v6.4.2  v7.0.2  Provides a structured process for converting a Request into a Response
symfony/intl                       v6.4.2  v7.0.2  Provides access to the localization data of the ICU library
symfony/mime                       v7.0.0  v7.0.0  Allows manipulating MIME messages
symfony/options-resolver           v6.4.0  v7.0.0  Provides an improved replacement for the array_replace PHP function
symfony/password-hasher            v7.0.0  v7.0.0  Provides password hashing utilities
symfony/polyfill-ctype             v1.28.0 v1.28.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme     v1.28.0 v1.28.0 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.28.0 v1.28.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.28.0 v1.28.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.28.0 v1.28.0 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.28.0 v1.28.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80             v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php83             v1.28.0 v1.28.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/process                    v6.4.2  v7.0.2  Executes commands in sub-processes
symfony/property-access            v6.4.0  v7.0.0  Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info              v6.4.0  v7.0.0  Extracts information about PHP class' properties using metadata of popular sources
symfony/routing                    v6.4.2  v7.0.2  Maps an HTTP request to a set of configuration variables
symfony/runtime                    v6.4.0  v7.0.0  Enables decoupling PHP applications from global state
symfony/security-acl               v3.3.3  v3.3.3  Symfony Security Component - ACL (Access Control List)
symfony/security-core              v6.4.0  v7.0.1  Symfony Security Component - Core Library
symfony/security-csrf              v7.0.1  v7.0.1  Symfony Security Component - CSRF Library
symfony/security-http              v6.4.0  v7.0.1  Symfony Security Component - HTTP Integration
symfony/serializer                 v6.4.2  v7.0.2  Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XM...
symfony/service-contracts          v3.4.1  v3.4.1  Generic abstractions related to writing services
symfony/stimulus-bundle            v2.13.3 v2.13.3 Integration with your Symfony app & Stimulus!
symfony/string                     v7.0.2  v7.0.2  Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                v6.4.2  v7.0.2  Provides tools to internationalize your application
symfony/translation-contracts      v3.4.1  v3.4.1  Generic abstractions related to translation
symfony/twig-bridge                v6.4.2  v7.0.2  Provides integration for Twig with various Symfony components
symfony/twig-bundle                v6.4.0  v7.0.0  Provides a tight integration of Twig into the Symfony full-stack framework
symfony/validator                  v6.4.2  v7.0.2  Provides tools to validate values
symfony/var-dumper                 v7.0.2  v7.0.2  Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter               v7.0.2  v7.0.2  Allows exporting any serializable PHP data structure to plain PHP code

PHP version

$ php -v
HP 8.3.1 (cli) (built: Dec 27 2023 23:06:02) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.1, Copyright (c), by Zend Technologies

Subject

PageBundle view page button does not work as expected. it renders wrong url.

Background

I'm using multisite: host_with_path_by_locale and I have defined 2 sites. One has relative path of null and another has /en and they are in different locale.

Problem

I go to
/en/admin/app/sonatapagepage/112/edit?site=2 which is the root page of the site where the relative page has been defined as /en
In the View page-button the rendered url is /en/en/ and in this case it should be just /en

@haivala
Copy link
Contributor Author

haivala commented Jan 11, 2024

With this setup If I create symfony route (which means the page bundle does not hand the route and is configured to ignore it) /anything and go to /en/anything it works. The problem is that when I try to create link with twig path function in this route I cannot force the locale in the path function. It will always have /en prefix. I guess this is the same problem.

@haivala
Copy link
Contributor Author

haivala commented Jan 16, 2024

_locale is ignored in this
<a href="{{ path(app.request.attributes.get('_route'), routeParams|merge({'_locale': 'fr'})) }}">FR</a>

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 14, 2024
@haivala
Copy link
Contributor Author

haivala commented Jul 20, 2024

This has not been resolved

@github-actions github-actions bot removed the stale label Jul 20, 2024
@haivala
Copy link
Contributor Author

haivala commented Sep 6, 2024

One more bug that is the same thing at the same button:
if I have 2 sites that have relative path (/fi, /en) the URL renders in /fi/admin/app/sonatapagepage/30/edit which is the root page of the fi site as /fi/fi/ and same problem in admin /en url

@tomazartack
Copy link

I have a fresh installation of Admin and Page Bundle on a fresh Symfony 6.4.*. Clicking on "View page" button gives this exception:

No route found for "GET http://domain.test/admin/app/sonatapagepage/12/sonatapageblock/-/custom" (from "http://domain.test/admin/app/sonatapagepage/12/sonatapageblock/list")

Can somebody explain me, what is wrong here? It's a fresh install and I just added some pages in the admin and trying things out.

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