Visitar URL original
[WIP] Improve the IDE compatibility by leofeyer · Pull Request #1 · contao/core-bundle · GitHub
Skip to content

[WIP] Improve the IDE compatibility - #1

Closed
leofeyer wants to merge 1866 commits into
developfrom
feature/ide-compat
Closed

leofeyer wants to merge 1866 commits into
developfrom
feature/ide-compat

Conversation

@leofeyer

Copy link
Copy Markdown
Member

The PR includes some exemplary changes to improve the IDE compatibility, which @aschempp has shown me at the Austriaday. @contao/developers I don't know if it were worth the effort to add this kind of information everywhere?

During my tests, I have noticed two limitations (there might be more):

 * @return Collection|null The model collection or null

This should be replaced with @return static, so the IDE can e.g. return MemberModel instead of just Model. However, this does only work with @return static, not with @return static|null, although the latter is actually the correct one. Does the IDE compatibility weigh more in this case?

/** @var Database_Result $result */
$result = $db->query("SELECT * FROM tl_content WHERE id=2");

echo $result->headline;
echo $result->text;

The IDE will always show the "property accessed via magic method" notice in this case, because it is impossible for the Database_Result class to know its properties.

leofeyer added 30 commits April 16, 2014 16:56
@ausi

ausi commented Feb 10, 2015

Copy link
Copy Markdown
Member

@leofeyer

Copy link
Copy Markdown
Member Author

I found a better solution:

class Template
{
    …

    /**
     * Create a new template object
     *
     * @param string $strTemplate    The template name
     * @param string $strContentType The content type (defaults to "text/html")
     *
     * @return static|object The template object
     */
    public static function create($strTemplate='', $strContentType='text/html')
    {
        return new static($strTemplate, $strContentType);
    }

    …

Now if you use the factory method instead of new, PhpStorm will handle the object correctly.

$this->Template = FrontendTemplate::create('nav_default');

@aschempp

Copy link
Copy Markdown
Member

Well the problem is also that most of the time we use $this->Template. So the controller class should probably define this as a property and define the type…

@ausi

ausi commented Feb 10, 2015

Copy link
Copy Markdown
Member

As I already mentioned in #1 (comment) IMO @return static|object is wrong.

@Toflar

Toflar commented Feb 10, 2015

Copy link
Copy Markdown
Member

Moreover, adding or removing code just for one specific IDE autocompletion feature imho feels really, really, really wrong! That applies for both, a useless factory method as well as extending stdClass for no reason.

@ausi

ausi commented Feb 10, 2015

Copy link
Copy Markdown
Member

@Toflar +1

@leofeyer

Copy link
Copy Markdown
Member Author

IDE compatibility is the least we can do to make developers life easier, given the fact that a complete refactoring will take years :)

But why don't you wait until I make the PR, then we can discuss further.

@leofeyer

Copy link
Copy Markdown
Member Author

The PR is now available: contao/core#7634 As discussed, I have removed the extends \stdClass part and I have removed the Template::create() factory method.

@leofeyer leofeyer closed this Feb 11, 2015
leofeyer pushed a commit that referenced this pull request Apr 20, 2015
@leofeyer
leofeyer deleted the feature/ide-compat branch October 9, 2015 14:08
leofeyer pushed a commit that referenced this pull request Nov 9, 2015
@goransi goransi mentioned this pull request Feb 1, 2018
leofeyer pushed a commit that referenced this pull request Oct 9, 2018
Description
-----------

Same as with hooks, you can now tag services as DCA callbacks.

Example tags: 
 - `{ name: contao.callback, table: tl_page, target: config.onload }`
 - `{ name: contao.callback, table: tl_member_group, target: list.label.label }`
 - `{ name: contao.callback, table: tl_article, target: fields.inColumn.options }`
 - `{ name: contao.callback, table: tl_content, target: fields.headline.save, method: mySaveMethod }`

Same as with hooks, the method is automatically generated if not given. E.g. `onLoadCallback` or `onOptionsCallback`.

**ToDo:**
 - [x] Unit Tests

Commits
-------

6577835f Initial draft
fb308ff8 Correctly generate method name for callback
7e192746 Fixed getting first callable for singleton callbacks
15bd7468 Added return type information for mixed method
246137e8 Actually register the compiler pass
08a3926c Added first round of unit tests
05243be8 Added remaining unit tests for listener
78792a70 Merge branch 'master' into feature/tagged-callbacks
fc597f17 Use references instead of array_replace_recursive() (#1)
7158ae1a CS Fixer
0501aa4f Correctly handle callbacks for wizard
878b0953 Fix the coding style and remove an unrelated change
leofeyer pushed a commit that referenced this pull request Nov 1, 2019
…es command (see #866)

Description
-----------

Together with @Toflar we had a hard time debugging why the `contao:resize-images` command stopped at some point and did not want to continue. The error message was quite unclear especially that the requested file existed:

```
6/77b26349-9084f1ba.jpg......... failed
Unable to open image /var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/77b26349.jpg
```

So we decided to introduce an option that allows to output more verbose error message simply by executing command in verbose mode `contao:resize-images -v`:

```
f/8ac5c4ec-213df40b.jpg.............. failed

 [ERROR] ImagickException: cache resources exhausted
         `/var/www/vhosts/domain.tld/httpdocs/releases/233/assets/images/../../var/pim-images/8ac5c4ec.jpg' @
         error/cache.c/OpenPixelCache/3864 in
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php:69
         Stack trace:
         #0 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/imagine/imagine/src/Imagick/Imagine.php(69):
         Imagick->__construct('/var/www/vhosts...')
         #1 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/Resizer.php(93):
         Imagine\Imagick\Imagine->open('/var/www/vhosts...')
         #2 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(185):
         Contao\Image\Resizer->executeResize(Object(Contao\Image\Image), Object(Contao\Image\ResizeCoordinates),
         '/var/www/vhosts...', Object(Contao\Image\ResizeOptions))
         #3 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/image/src/DeferredResizer.php(108):
         Contao\Image\DeferredResizer->executeDeferredResize('f/8ac5c4ec-213d...', Array,
         Object(Imagine\Imagick\Imagine))
         #4
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(189): Contao\Image\DeferredResizer->resizeDeferredImage(Object(Contao\Image\DeferredImage), false)
         #5
         /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/contao/core-bundle/src/Command/ResizeImagesComma
         nd.php(166): Contao\CoreBundle\Command\ResizeImagesCommand->resizeImage('f/8ac5c4ec-213d...',
         Object(Symfony\Component\Console\Style\SymfonyStyle))
         #6 /var/www/vhosts/domain.tld/httpdocs/releases/233/vendor/symfony/console/Command/Command.php(255):
```

Commits
-------

e9c6de99 Allow to output more verbose error messages in contao:resize-images command
leofeyer pushed a commit that referenced this pull request Jun 10, 2020
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #1553 
| Docs PR or issue | -

This sets `tl_user.locked = 0` and `tl_user.loginCount = <defaultLoginCount>` when resetting the password. 

@leofeyer Do you want me to create another PR against the 4.9 branch that adapts the changes to use the new `loginAttempts` vs `loginCount` or do you do that yourself when merging? (imo it's a one liner there)

Commits
-------

a5c3777b reset lock + login count when resetting password
a609cdda Simplify the code
7d29603d Merge pull request #1 from leofeyer/fix/user-password-command

Simplify the code
leofeyer pushed a commit that referenced this pull request Aug 4, 2020
Description
-----------

With @Toflar we have discovered by accident that if a URL is double-encoded (for some reason, doesn't matter) the Contao's `RouteProvider` will eventually throw an error trying to query a database.

```
URL original: drachenlochmuseum-v%25c3%25a4ttis.html
URL decoded: drachenlochmuseum-v%c3%a4ttis.html
URL decoded 2nd time: drachenlochmuseum-vättis.html
```

The decoded URL is used in the database query and that fails because the database driver would like to replace wildcards `%c` with parameters that were not provided.

Stack trace:

```
Exception: Too few arguments to build the query string
#27 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(304): replaceWildcards
#26 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Database/Statement.php(249): execute
#25 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(1102): find
#24 vendor/contao/core-bundle/src/Resources/contao/library/Contao/Model.php(973): findBy
#23 vendor/contao/core-bundle/src/Framework/Adapter.php(38): __call
#22 vendor/contao/core-bundle/src/Routing/RouteProvider.php(493): findPages
#21 vendor/contao/core-bundle/src/Routing/RouteProvider.php(88): getRouteCollectionForRequest
#20 vendor/contao/core-bundle/src/Routing/LegacyRouteProvider.php(43): getRouteCollectionForRequest
#19 vendor/symfony-cmf/routing/src/NestedMatcher/NestedMatcher.php(141): matchRequest
#18 vendor/contao/core-bundle/src/Routing/Matcher/LegacyMatcher.php(69): matchRequest
#17 vendor/symfony-cmf/routing/src/DynamicRouter.php(271): matchRequest
#16 vendor/symfony-cmf/routing/src/ChainRouter.php(188): doMatch
#15 vendor/symfony-cmf/routing/src/ChainRouter.php(158): matchRequest
#14 vendor/symfony/http-kernel/EventListener/RouterListener.php(115): onKernelRequest
#13 vendor/symfony/event-dispatcher/EventDispatcher.php(212): doDispatch
#12 vendor/symfony/event-dispatcher/EventDispatcher.php(44): dispatch
#11 vendor/symfony/http-kernel/HttpKernel.php(126): handleRaw
#10 vendor/symfony/http-kernel/HttpKernel.php(67): handle
#9 vendor/symfony/http-kernel/Kernel.php(198): handle
#8 vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(85): handle
#7 vendor/symfony/http-kernel/HttpCache/HttpCache.php(448): forward
#6 vendor/symfony/framework-bundle/HttpCache/HttpCache.php(57): forward
#5 vendor/symfony/http-kernel/HttpCache/HttpCache.php(420): fetch
#4 vendor/contao/manager-bundle/src/HttpKernel/ContaoCache.php(46): fetch
#3 vendor/symfony/http-kernel/HttpCache/HttpCache.php(317): lookup
#2 vendor/symfony/http-kernel/HttpCache/HttpCache.php(192): handle
#1 vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(98): handle
#0 web/app.php(58): null
```

Commits
-------

8ae25820 Fix a potential error if the URL has percentage in it
8caaf252 Fix unit tests
509f7624 Correctly encode the page aliases
leofeyer pushed a commit that referenced this pull request May 18, 2021
Description
-----------

This is a POC (though thoroughly discussed with @aschempp so it's probably a bit more than just a POC :)) to have a new way to **add or change page meta data dynamically**.
This includes all the things like

* Changing the page tilte, description and robots meta content (included in this PR for demonstration purposes)
* Adding `<script>` tags on the fly (replacing `$GLOBALS['TL_JAVASCRIPT']`)
* Adding `<link>` tags on the fly (replacing `$GLOBALS['TL_CSS']` or `$GLOBALS['TL_HEAD']`)
* etc.

While discussing with @aschempp what all of this represents, we noticed that all of it is basically

> adding information to the future response which is not generated yet.

Examples:

* When you set `$objPage->pageTitle` you do so, because the `Response` has not been generated yet and you cannot set `<title>` right away.
* When you use `$GLOBALS['TL_JAVASCRIPT']` you do so, because there's no way for you to access the current `Response` and add this to the future HTML somehow because it's not even generated yet. 
* etc.

Moreover:

> You don't even know if a script, page title, page description etc. is even going to be used or if you potentially waste resources generating something that's then never required.

Hence, here's what we noticed: What we need is a **ResponseContext**.
A page controller cannot generate the `Response` for you beforehand but it can tell, what context is going to be applied and thus, what options you have:

* Is it a regular `WebpageContext` (terminology taken from schema.org) you're going to generate? So a typical HTML page? If so there sure is a `setTitle()` and a `setDescription()`.
* Is it an ESI fragment? It would probably use an `EsiContext` because `setTitle()` or `setDescription()` typically make no sense.

Proof (or rather, why we think) that this concept is going to work:

* It will play nicely with the future real page controllers, @aschempp is working on in contao/contao#2015. The process for a page controller would be like so:
    1. Set the `ResponseContext` according to what the controller does. Will it output `XML` only? Then don't set it to `WebpageContext` because offering `setTitle()` and `setDescription()` makes no sense. But maybe something else makes sense? 
    2. Generate the modules, content elements (if you want to do that in your page type). Anything collected here will write to the `ResponseContext` if provided and implementing the correct interfaces.
    3. The resulting `ResponseContext` has to be applied to the final response by the page controller. It's entirely the developer's responsibility to apply this. In other words, as a developer you specify the `ResponseContext` you **are going to** to return. Then you generate code you **do not control** like third party modules which **have access to the current context and can thus decide what to do**. Finally, you apply the changes **you said you were going to pass on** to the final response.
* It also plays very nicely with the centralized JSON-LD PR proposed in contao/contao#2962. I will update the PR shortly to show how this now works together beautifully. The context specifies that it understands JSON-LD which enables modules to access the `JsonLdManager` and add more information. And here's the beauty in this concept. Both, the `WebpageContext` as well as a possible `EsiContext` can implement the correct interface and thus **indicate to modules, elements, templates** that **they are going to** use this data. For the `WebpageContext` this is rather obvious because the data will be displayed before the closing `</body>` but JSON-LD works perfectly fine for an ESI fragment as well. You just have to make sure to output it inline. :-)

## Design decisions:

* The `ResponseContext` is deliberately optional. A page controller is not required to provide a `ResponseContext` at all. If there is none, then no module, content element etc. can add anything to the context which is the intended behaviour.
* There are multiple providers for different `ResponseContextInterface` implementations. These serve as factories. This enables container access, you'll see a use case in the JSON-LD PR where we need access to the EventDispatcher.
* The `WebpageContext` does not have any interface because I don't feel like it's worth it. I don't want to have 30 interfaces for every single feature a `ResponseContext` might support. We can still extract them in the future if we see that something can be re-used a lot across different contexts (such as JSON-LD in the other PR).

## Additional notes

* I've only replaced the deprecations in the `news-bundle` so far to show how easy it is to get rid of those and switch to the new context. We should ideally get rid of all deprecation notices but it's not a requirement to finish this PR.
* No unit tests so far as I would like to know if the Core team likes the concept first. I'll clean up afterwards.

Commits
-------

efb3272a Implemented POC for new ResponseContext concept
90af1286 Example of how to get rid of deprecation notices and use the new concept within the news bundle
657406d6 Implemented ResponseContext factories to enable arbitrary services
4b706b37 Fixed BC
4042b44a Renamed method to be clear that this does not map the whole context but only the header bag
dcf8fb00 CS
131d4706 Renamed context to be more precise
0941b6fc Added unit tests
47737663 Merge branch '4.x' into feature/response-context
5e69b26d Ensure we have a completely empty header bag for the response context
e9b6dc21 Fixed namespace issue
bb3c4941 Compatibility with lowest deps
83bbaccf Only trigger deprecation notice if the properties are set on the global page object
58f3728a CS
44e2445c CS
e199e237 move psalm generics annotations from class to method level
9cb98dfd use real class for supports test
b20a48eb Merge pull request #1 from m-vo/feature/reponse-context/psalm
97d6405f Implemented terminating a response context and dispatching a core event for that (totally optional)
8a169132 Add response to TerminateResponseContextEvent
8f41be7a Renamed methods
89017844 Do not set the response context again in PageRegular. It must be at the beginning of every controller.
3e07b340 Reworked concept again
bb5a70ff Merge branch '4.x' into feature/response-context
deeab1af Make sure we set the current context in PageRegular not FrontendIndex
d829f75a Fixed missing robots support for ContaoWebpageResponseContext
eae2ddc0 Re-add finalize() method to ResponseContext interface
2373eac3 Merge branch '4.x' into feature/response-context

* 4.x:
  CS fixes for 4.x (see #3005)
a45772f8 CS
ec26b843 Merge branch '4.x' into feature/response-context
0dfab0b6 CS
753a0483 Adjust the other classes as well
bd9a4a30 Remove the assertInstanceOf() check in the CoreResponseFactoryTest
leofeyer pushed a commit that referenced this pull request Mar 27, 2023
Description
-----------

`tl_content.html` is nullable and thus the following error can occur:

```
TypeError:
Contao\CoreBundle\Twig\Runtime\InsertTagRuntime::replaceInsertTags(): Argument #1 ($text) must be of type string, null given, called in var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php on line 95

  at vendor\contao\contao\core-bundle\src\Twig\Runtime\InsertTagRuntime.php:33
  at Contao\CoreBundle\Twig\Runtime\InsertTagRuntime->replaceInsertTags(null)
     (var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php:95)
  at __TwigTemplate_ec9b51ce37f7fdfbb114fb5f8d792795->block_html(array('type' => 'html', 'template' => 'content_element/html', … 
```

Commits
-------

220ea22b fix error in html template
leofeyer pushed a commit that referenced this pull request Nov 2, 2023
Description
-----------

When you use the `{{form_session_data::*}}` insert tag the following error will occur:

```
TypeError:
Contao\CoreBundle\InsertTag\InsertTagResult::__construct(): Argument #1 ($value) must be of type Stringable|string, null given, called in vendor\contao\contao\core-bundle\src\InsertTag\Resolver\FormInsertTag.php on line 32

  at vendor\contao\contao\core-bundle\src\InsertTag\InsertTagResult.php:20
  at Contao\CoreBundle\InsertTag\InsertTagResult->__construct(null, object(OutputType))
     (vendor\contao\contao\core-bundle\src\InsertTag\Resolver\FormInsertTag.php:32)
  at Contao\CoreBundle\InsertTag\Resolver\FormInsertTag->replaceSessionData(object(ResolvedInsertTag))
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:419)
  at Contao\CoreBundle\InsertTag\InsertTagParser->renderSubscription(object(ResolvedInsertTag), false)
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:391)
  at Contao\CoreBundle\InsertTag\InsertTagParser->executeReplace(object(ParsedSequence), false, object(OutputType))
     (vendor\contao\contao\core-bundle\src\InsertTag\InsertTagParser.php:155)
  at Contao\CoreBundle\InsertTag\InsertTagParser->replaceInline('<p>{{form_session_data::foobar}}</p>')
     (vendor\contao\contao\core-bundle\src\Twig\Runtime\InsertTagRuntime.php:35)
  at Contao\CoreBundle\Twig\Runtime\InsertTagRuntime->replaceInsertTags('<p>{{form_session_data::foobar}}</p>')
     (var\cache\dev\twig\c0\c00587c3bfdf175108bed29053e23923.php:164)
```

Commits
-------

9698b1d5 fix type error in FormInsertTAg
leofeyer pushed a commit that referenced this pull request Apr 17, 2024
Description
-----------

We encountered an `ErrorException` when the page of external redirect type has an insert tag that returns an empty string.

The problem in fact happens in the `UrlHelper` component of Symfony, but I think we should fix it on our side nevertheless.

Stack trace:

```
ErrorException: Warning: Uninitialized string offset 0
#36 /vendor/symfony/http-foundation/UrlHelper.php(42): Symfony\Component\HttpFoundation\UrlHelper::getAbsoluteUrl
#35 /vendor/contao/core-bundle/src/Routing/Content/StringResolver.php(40): Contao\CoreBundle\Routing\Content\StringResolver::resolve
#34 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(150): Contao\CoreBundle\Routing\ContentUrlGenerator::resolveContent
#33 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(161): Contao\CoreBundle\Routing\ContentUrlGenerator::resolveContent
#32 /vendor/contao/core-bundle/src/Routing/ContentUrlGenerator.php(70): Contao\CoreBundle\Routing\ContentUrlGenerator::generate
#31 /vendor/contao/core-bundle/contao/modules/Module.php(349): Contao\Module::renderNavigation
#30 /vendor/contao/core-bundle/contao/modules/Module.php(326): Contao\Module::renderNavigation
#29 /vendor/contao/core-bundle/contao/modules/Module.php(326): Contao\Module::renderNavigation
#28 /vendor/contao/core-bundle/contao/modules/ModuleNavigation.php(82): Contao\ModuleNavigation::compile
#27 /vendor/contao/core-bundle/contao/modules/Module.php(213): Contao\Module::generate
#26 /vendor/contao/core-bundle/contao/modules/ModuleNavigation.php(45): Contao\ModuleNavigation::generate
#25 /vendor/contao/core-bundle/contao/library/Contao/Controller.php(410): Contao\Controller::getFrontendModule
…
#1 /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(96): Contao\ManagerBundle\HttpKernel\ContaoCache::handle
#0 /public/index.php(42): null
```

Commits
-------

756336e7 Fix a potential issue if the insert tags return an empty string in th…
0a9330c2 Throw an exception if the insert tag returns an empty value
46de08ef CS + Unit test
89521539 Rename the test method
leofeyer pushed a commit that referenced this pull request May 23, 2024
…licating a page (see #7102)

Description
-----------

If a user who is not an admin copies a page, the articles (and thus all content) are no longer copied, as it was the case in Contao 4. Instead a new empty article is created.
This is because the check whether the user is allowed to create the articles depends on the pagemountCache in the BackendAccessVoter, which is only set once per request and user. 
As the page does not yet exist when the cache is first set and has not been reset after the page has been created, the check as to whether the user is allowed to access the newly created page fails.

This PR adds a check if a new page has been created before accessing the pagemountCache in the BackendAccessVoter and clears the cache if this is the case.


Steps to reproduce:

1. Login as a user without admin privileges
2. Copy and paste a page that has content elements in its article
3. The original article(s) will not be copied but a new one will be created

Commits
-------

45f2cbb5 Change pagemountCache structure in BackendAccessVoter
5257361d Store true/false in the pagemountsCache
c53c4e10 Merge pull request #1 from aschempp/fix/page-access
f30b8f05 Merge pull request #2 from lukasbableck/5.3
ed3f337c run rector
479dad1c run ecs fix
0c3bba24 Revert "Change pagemountCache structure in BackendAccessVoter"
d031b280 check if page is in pagemountsCache and rebuild cache if not before r…

Co-authored-by: aschempp <andreas.schempp@terminal42.ch>
leofeyer pushed a commit that referenced this pull request May 29, 2024
… #7248)

Description
-----------

If a `tl_article` record still contains `keywords` from previous Contao versions and you reference this article in an `article` content element, the following warning will appear in the back end:

```
ErrorException: Warning: Undefined global variable $TL_KEYWORDS
#24 /vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php(207): Contao\ModuleArticle::compile
#23 /vendor/contao/core-bundle/src/Resources/contao/modules/Module.php(214): Contao\Module::generate
#22 /vendor/contao/core-bundle/src/Resources/contao/modules/ModuleArticle.php(70): Contao\ModuleArticle::generate
#21 /vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(550): Contao\Controller::getArticle
#20 /vendor/contao/core-bundle/src/Resources/contao/elements/ContentArticle.php(30): Contao\ContentArticle::generate
#19 /vendor/contao/core-bundle/src/Resources/contao/library/Contao/Controller.php(622): Contao\Controller::getContentElement
#18 /var/cache/prod/contao/dca/tl_content.php(318): tl_content::addCteType
#17 /vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php(4717): Contao\DC_Table::parentView
#16 /vendor/contao/core-bundle/src/Resources/contao/drivers/DC_Table.php(313): Contao\DC_Table::showAll
#15 /vendor/contao/core-bundle/src/Resources/contao/classes/Backend.php(667): Contao\Backend::getBackendModule
#14 /vendor/contao/core-bundle/src/Resources/contao/controllers/BackendMain.php(168): Contao\BackendMain::run
#13 /vendor/contao/core-bundle/src/Controller/BackendController.php(49): Contao\CoreBundle\Controller\BackendController::mainAction
#12 /vendor/symfony/http-kernel/HttpKernel.php(163): Symfony\Component\HttpKernel\HttpKernel::handleRaw
#11 /vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel::handle
#10 /vendor/symfony/http-kernel/Kernel.php(202): Symfony\Component\HttpKernel\Kernel::handle
#9 /vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php(86): Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle
#8 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(481): Symfony\Component\HttpKernel\HttpCache\HttpCache::forward
#7 /vendor/symfony/framework-bundle/HttpCache/HttpCache.php(73): Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache::forward
#6 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(454): Symfony\Component\HttpKernel\HttpCache\HttpCache::fetch
#5 /vendor/contao/manager-bundle/src/HttpKernel/ContaoCache.php(66): Contao\ManagerBundle\HttpKernel\ContaoCache::fetch
#4 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(348): Symfony\Component\HttpKernel\HttpCache\HttpCache::lookup
#3 /vendor/symfony/http-kernel/HttpCache/HttpCache.php(226): Symfony\Component\HttpKernel\HttpCache\HttpCache::handle
#2 /vendor/friendsofsymfony/http-cache/src/SymfonyCache/EventDispatchingHttpCache.php(96): Contao\ManagerBundle\HttpKernel\ContaoCache::handle
#1 /web/index.php(44): require
#0 /web/app.php(13): null
```

This is because `$GLOBALS['TL_KEYWORDS']` is only initialised in the front end within `PageRegular::prepare()`. This PR simply ignores it if not set.

Commits
-------

e54dc2b8 fix warning when legacy keywords are present
leofeyer pushed a commit that referenced this pull request Jun 7, 2024
…#7268)

Description
-----------

Got this erro in my logs:

```
RuntimeException: The Symfony container is not available, did you initialize the Contao framework? in vendor/contao/core-bundle/contao/library/Contao/System.php:143 Stack trace:
#0 vendor/contao/core-bundle/contao/library/Contao/System.php(97): Contao\System->import('Contao\\Config', 'Config')
#1 vendor/contao/core-bundle/contao/library/Contao/DcaExtractor.php(105): Contao\System->__construct()
#2 vendor/contao/core-bundle/contao/library/Contao/DcaExtractor.php(140): Contao\DcaExtractor->__construct('tl_opt_in')
#3 vendor/contao/core-bundle/contao/library/Contao/Model.php(291): Contao\DcaExtractor::getInstance('tl_opt_in')
#4 vendor/contao/core-bundle/contao/library/Contao/Model.php(1084): Contao\Model::getUniqueFields()
#5 vendor/contao/core-bundle/contao/models/OptInModel.php(87): Contao\Model::findBy(Array, 1716888783, Array)
#6 vendor/contao/core-bundle/src/Framework/Adapter.php(38): Contao\OptInModel::findExpiredTokens()
#7 vendor/contao/core-bundle/src/OptIn/OptIn.php(76): Contao\CoreBundle\Framework\Adapter->__call('findExpiredToke...', Array)
#8 vendor/contao/core-bundle/src/Cron/PurgeOptInTokensCron.php(30): Contao\CoreBundle\OptIn\OptIn->purgeTokens()
#9 vendor/contao/core-bundle/src/Cron/CronJob.php(44): Contao\CoreBundle\Cron\PurgeOptInTokensCron->__invoke('cli')
#10 vendor/contao/core-bundle/src/Cron/Cron.php(197): Contao\CoreBundle\Cron\CronJob->__invoke('cli')
#11 vendor/contao/core-bundle/src/Cron/Cron.php(182): Contao\CoreBundle\Cron\Cron->executeCrons(Array, 'cli', Object(Closure))
#12 vendor/contao/core-bundle/src/Cron/Cron.php(97): Contao\CoreBundle\Cron\Cron->doRun(Array, 'cli', false)
#13 vendor/contao/core-bundle/src/Command/CronCommand.php(53): Contao\CoreBundle\Cron\Cron->run('cli', false)
#14 vendor/symfony/console/Command/Command.php(326): Contao\CoreBundle\Command\CronCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(Contao\CoreBundle\Command\CronCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 vendor/contao/manager-bundle/bin/contao-console(40): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#21 vendor/bin/contao-console(119):  #22
```

Commits
-------

9ee76a07 Initialize the Contao framework when working with opt-in tokens
leofeyer added a commit that referenced this pull request Aug 9, 2024
…7367)

Description
-----------

In Contao 5 if there is enough content in an element for its height to be limited, the content overlaps the .limit_toggler. This makes the toggler very hard to see. Also the content is cut off right at the border.
With this PR it looks more like Contao 4.13 again, but with a gradient at the bottom.

C4.13
<img width="706" alt="image" src="https://github.com/user-attachments/assets/581a475c-ba75-4039-8bbd-94d693bd0db2">

C5.3 currently
<img width="897" alt="image" src="https://github.com/user-attachments/assets/419115bc-0c4e-4035-b5fb-5b58ec755769">

C5.3 with this change
see contao/contao#7367 (comment)

Commits
-------

7fd8ffc9 Add z-index to .limit_toggler
5c8630dc Add gradient to .limit_toggler and border to button
b93646a3 Fix .limit_toggler background gradient on hover
ea9decda only set background gradient on .limit_toggler if target is collapsed
1173d476 Update core-bundle/contao/themes/flexible/styles/main.css
cf4c30a9 Consider hover-background on limit-toggler gradient
b5ba8d8b Gradient adjustments for better visibility
525babc4 Merge pull request #1 from zoglo/fix/limit-toggler-visibility
33e3dbf3 Remove border from `limit-toggler`
b0a80fee Rebuild the assets

Co-authored-by: zoglo <55794780+zoglo@users.noreply.github.com>
Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
leofeyer added a commit that referenced this pull request Oct 1, 2024
Description
-----------

Implements #7271

Commits
-------

2bc43018 Update swiper.html.twig
d8d36d10 Update swiper.html.twig
c6d2885e Revert "Update swiper.html.twig"
a0ce54ad build slider_settings in controller
29ef7f7b remove asset
48ce7302 fix typo
51e767fe Merge pull request #1 from fritzmg/swiper-7470
c1364ea3 remove asset
6a2111d0 fix test
d9cdb37c update assets
516970e8 rename variable
9403040e Merge remote-tracking branch 'origin/5.x' into 7470-fix-ci
0ba3867b Merge pull request #2 from fritzmg/7470-fix-ci
63d98741 added comment with example swiper.html.twig
99909376 correcting some space swiper.html.twig
61c6e12a Update core-bundle/contao/templates/twig/content_element/swiper.html.…
30bc3556 Remove the old data attributes
0f1d9990 Fix the unit test

Co-authored-by: fritzmg <fmg@inspiredminds.at>
Co-authored-by: leofeyer <1192057+leofeyer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants