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

Feature/extract mobile page layout #351

Merged
merged 10 commits into from Feb 19, 2019

Conversation

@Toflar
Copy link
Member

commented Feb 18, 2019

I've extracted the mobile page layout feature into its own bundle: https://github.com/Toflar/contao-mobile-page-layout-bundle

To do so, I had to implement two things:

  • Ability for third party bundles to add a callback that allows to configure inheritance during PageModel::loadDetails(). I could've used this several times before anyway.
  • The {{toggle_view}} insert tag must never be cached but so far we had no possibility in the current insert tag handling to make sure one can make their own insert tag uncacheable without having to set the |uncached flag. I've invented an additional insert tag named {{esi::<real-inserttag>}} which allows to wrap your insert tag. That way, you can force Contao to re-use the ESI request when the $blnCache flag is set accordingly. See https://github.com/Toflar/contao-mobile-page-layout-bundle/blob/master/src/EventListener/InsertTags/ToggleViewListener.php#L58 for an example.

@Toflar Toflar force-pushed the Toflar:feature/extract-mobile-page-layout branch from 2fb2650 to 0601e7c Feb 18, 2019

if ($objLayout === null)
{
continue;
return array();

This comment has been minimized.

Copy link
@leofeyer

leofeyer Feb 19, 2019

Member

Are you sure that this is correct?

This comment has been minimized.

Copy link
@Toflar

Toflar Feb 19, 2019

Author Member

Yes, it's not a loop anymore so if there's nothing to load the options from, it's going to be an empty array.

@@ -919,24 +912,20 @@ public function loadDetails()
$this->clientCache = $this->clientCache !== false ? $this->clientCache : $objParentPage->clientCache;
}
// Protection

This comment has been minimized.

Copy link
@leofeyer

leofeyer Feb 19, 2019

Member

Why did you move this code block?

This comment has been minimized.

Copy link
@Toflar

Toflar Feb 19, 2019

Author Member

Guess that must have been an issue during rebase. Fixed in 92007bc.

}
elseif (Input::cookie('TL_VIEW') == 'desktop')
// HOOK: modify the page or layout object (see #4736)
if (isset($GLOBALS['TL_HOOKS']['getPageLayout']) && \is_array($GLOBALS['TL_HOOKS']['getPageLayout']))

This comment has been minimized.

Copy link
@leofeyer

leofeyer Feb 19, 2019

Member

Why did you move the hook?

This comment has been minimized.

Copy link
@Toflar

Toflar Feb 19, 2019

Author Member

Because the method says getPageLayout(). So I figured that's the correct way to place the hook. The order is still the same, it finds the assigned layout and then calls the hook.

@leofeyer leofeyer added the feature label Feb 19, 2019

@leofeyer leofeyer added this to the 4.8.0 milestone Feb 19, 2019

Toflar and others added 2 commits Feb 19, 2019

@leofeyer leofeyer merged commit 29c6c71 into contao:master Feb 19, 2019

0 of 2 checks passed

Travis CI - Pull Request Build Errored
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
@leofeyer

This comment has been minimized.

Copy link
Member

commented Feb 19, 2019

Thank you @Toflar.

@Toflar Toflar deleted the Toflar:feature/extract-mobile-page-layout branch Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.