Sorry if this is a duplicate, but I couldn't find an issue for it. I'm trying to add a page title block to a panels display that has the page title configured directly through the Panels UI. If I use a block outside of the panels layout, it displays fine, but when I place the page title block inside the panels display, nothing shows up. Looking a little deeper, it appears there's a matching issue for the block page variant #2626090: Page title block placed on block page renders empty, but I can't find anything for Panels.

CommentFileSizeAuthor
#42 panels--page-title_does_not_display_8.4.x.patch8.23 KByeaha
#27 panels--page_title_does_not_display--2869412-27.patch8.1 KBAlumei
#27 panels--page_title_does_not_display--2869412-27.testOnly.patch4.14 KBAlumei
#24 panels--page_title_does_not_display--2869412-24.testOnly.patch2.31 KBAlumei
#24 panels--page_title_does_not_display--2869412-24.patch6.26 KBAlumei
#18 panels--page_title_does_not_display--16-19.interdiff.txt2.54 KBAlumei
#18 panels--page_title_does_not_display--2869412-19.patch3.95 KBAlumei
#17 panels--page_title_does_not_display--16-17.interdiff.txt1.83 KBAlumei
#17 panels--page_title_does_not_display--2869412-17.patch3.95 KBAlumei
#16 panels--page_title_does_not_display--12-16.interdiff.txt771 bytesAlumei
#16 panels--page_title_does_not_display--2869412-16.patch2.8 KBAlumei
#12 interdiff-9-12.txt2.08 KBpiggito
#12 page_title_does_not_display-2869412-12.patch2.8 KBpiggito
#9 page_title_does_not_display-2869412-9.patch2.92 KBpiggito
#2 2869412-2-page_title_does_not_show_in_panels.patch2.73 KBrbayliss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rbayliss created an issue. See original summary.

rbayliss’s picture

Here's an attempt at a fix. I'm looking for some feedback on the approach, although I'm aware it will need tests. Is it kosher to expose the renderPageTitle() method on the PanelsDisplayVariant? If so, should renderPageTitle() have some logic to automatically call getPageTitle()?

rbayliss’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 2869412-2-page_title_does_not_show_in_panels.patch, failed testing.

sylus’s picture

This got the title to work for me as well, and is very similar to the approach leveraged in the corresponding patch. ^_^

The only thing I noticed is that when page_title_block is leveraged is should take over the title handling functionality from the DisplayVariant. Right now I get both the title from the Display and the new added page_title_block.

Thanks so much for pushing this forward!

arosboro’s picture

This patch is working well, I did notice that if show title is checked on the title block it shows the actual page title (twice), not the manually configured title in the block settings.

moymilo’s picture

Assigned: Unassigned » moymilo
dstorozhuk’s picture

Assigned: moymilo » Unassigned
piggito’s picture

Adding a reroll for the patch in #2
The patch works but we still need to fix the tests to consider the new call to getPageTitle()

andypost’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: page_title_does_not_display-2869412-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

piggito’s picture

andypost’s picture

Queued for php71 as well

+++ b/src/Plugin/DisplayBuilder/StandardDisplayBuilder.php
@@ -95,12 +96,14 @@ class StandardDisplayBuilder extends DisplayBuilderBase implements PluginWizardI
+  protected function buildRegions(array $regions, array $contexts, string $title = NULL) {

btw `string` type will not work in PHP 5.5.9 as minimal supported by core

Status: Needs review » Needs work

The last submitted patch, 12: page_title_does_not_display-2869412-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

andres.torres’s picture

Confirmed, same behavior when trying to add the Page Title block using Panelizer, title won't display.
Running the patch #12 throws the following msgs:

patching file src/Plugin/DisplayBuilder/StandardDisplayBuilder.php
Hunk #1 FAILED at 3.
Hunk #2 succeeded at 83 (offset -12 lines).
Hunk #3 succeeded at 107 (offset -12 lines).
Hunk #4 succeeded at 163 (offset -14 lines).
1 out of 4 hunks FAILED -- saving rejects to file src/Plugin/DisplayBuilder/StandardDisplayBuilder.php.rej
patching file tests/src/Unit/StandardDisplayBuilderTest.php
Hunk #1 succeeded at 66 (offset -3 lines).

and the title starts showing up as [node:title] instead of rendering the title string.

Alumei’s picture

Removed the 'string' typehint from the method signature as pointed out in #13.

Alumei’s picture

I got the same problem as @andres.torres described in #15 with token replacement. This is due to the fact that the patch only uses the RAW value for the title block instead of the "rendered" one.
So this patch resolves that by exposing the "rendered" title on the PanelsDisplayVariant.

The last submitted patch, 17: panels--page_title_does_not_display--2869412-17.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

The last submitted patch, 12: page_title_does_not_display-2869412-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Alumei’s picture

Retesting the latest patch from #18

Alumei’s picture

Is there any way to push this forward as this issue affects PE #2933423: Content of placed title block does not show up.

Is there something still missing? Given some pointers I would be happy to improve the patch if necessary.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, except not all broken places covered with tests

Alumei’s picture

I tried building a test that verifies that a the title is build correctly & that a token is evaluated correctly as well.
As the later part requires working token behavior I tried to implement it as a Kernel test.

But I keep running into the problem:

Call to undefined function Drupal\Core\Extension\system_get_info()
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php:780
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php:52
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php:34
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Block/BlockManager.php:49
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:286
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:175
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php:22
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php:16
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Component/Plugin/PluginManagerBase.php:76
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php:81
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php:80
 /home/aluquot/Documents/repos/contribute/drupal/modules/contrib/ctools/src/Plugin/BlockPluginCollection.php:19
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php:160
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php:135
 /home/aluquot/Documents/repos/contribute/drupal/modules/contrib/ctools/src/Plugin/DisplayVariant/BlockDisplayVariant.php:155
 /home/aluquot/Documents/repos/contribute/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php:479
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Display/VariantBase.php:30
 /home/aluquot/Documents/repos/contribute/drupal/modules/contrib/ctools/src/Plugin/DisplayVariant/BlockDisplayVariant.php:98
 /home/aluquot/Documents/repos/contribute/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php:107
 /home/aluquot/Documents/repos/contribute/panels/src/Plugin/DisplayVariant/PanelsDisplayVariant.php:126
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php:21
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Component/Plugin/PluginManagerBase.php:84
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php:62
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php:80
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php:83
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php:99
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php:55
 /home/aluquot/Documents/repos/contribute/drupal/modules/contrib/page_manager/src/Entity/PageVariant.php:226
 /home/aluquot/Documents/repos/contribute/drupal/modules/contrib/page_manager/src/Entity/PageVariant.php:235
 /home/aluquot/Documents/repos/contribute/panels/panels.module:35
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php:402
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:376
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Entity/EntityStorageBase.php:191
 /home/aluquot/Documents/repos/contribute/drupal/core/lib/Drupal/Core/Entity/Entity.php:544
 /home/aluquot/Documents/repos/contribute/panels/tests/src/Kernel/StandardDisplayBuilderTest.php:55

I get to that point as soon as I try to construct a PageVariant with a title-block configured.
I attached 2 to showcases this, does somebody have a solution?

The last submitted patch, 24: panels--page_title_does_not_display--2869412-24.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: panels--page_title_does_not_display--2869412-24.testOnly.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Alumei’s picture

Status: Needs work » Needs review

The last submitted patch, 27: panels--page_title_does_not_display--2869412-27.testOnly.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

andypost’s picture

That looks great!
Looking at fix I wondered why getRenderedPageTitle() added? It looks like just wrapper that not needed

Also issue summary needs update

Alumei’s picture

getRenderedPageTitle() is used at two paces:

  • Drupal\panels\Plugin\DisplayVariant\PanelsDisplayVariant:build() => Were it is used to set '#title' for the page
  • Drupal\panels\Plugin\DisplayBuilder\StandardDisplayBuilder:buildRegions() => Were previous patches added the code to set the title for the title block

As both places needed a renderPageTitle() & getPageTitle() call I found it seemed like the most straight forward solution to add getRenderedPageTitle() that combines both and does not require renderPageTitle() to be changed from protected to public.

toddwoof’s picture

Maybe I have a different issue, but the node title does not display for me _unless_ I place it in a block. So if I add [node:title] or anything else to "Page title," it is not rendered. I can add a block to the layout with the page title, but then there's no control over the markup.

Anyone else seeing this? Tried the patch in #27; no change. Brand new site, just starting to set up (8.5.3, nothing unusual).

toddwoof’s picture

Okay, maybe my issue is more similar than I had thought. My use case is Adaptive Theme and Drupal 8.5.3, brand new site. (But I tested in Seven also.)

I started adding page title blocks in the block layout, and discovered that I can get the page title to display for panelized content types if three things are present: (1) there is a page title block in the block settings in the Main content area, and (2) there is another page title block in the block settings outside the Main content area (such as Content prefix), and (3) I have the content type panelized and [node:title] entered in the Page title field.

The two blocks in the blocks layout don't need to have any content types checked, but they both have to be there. Remove either one, and the node title vanishes.

So: Am I misunderstanding how this is supposed to work? Seems to me that just #3 should be needed.

Alumei’s picture

@toodwoof - From what I gathered when working on the patches it seemed as follows:

If a panel is displayed as the main-content on a page the configured panels title is set for the page title rendering.

If one now only places a page title block outside of panes on the page via the block configuration page, that block should use the title intended for page title rendering. In that case it would be the panes title.

If one now only places a page title block inside of the panel, without a patch of this issue, that block would remain empty. This issue is trying to solve that use-case, by passing along the relevant page title information to the placed page-title block.

I would expect that your (3) is the most relevant as it ensures that the correct title is displayed. As for the rest I would actually expect that either (1) or (2) would suffice to get the panels title to show as page title, so long as the latest patch is applied ... strange!

Status: Needs review » Needs work

The last submitted patch, 27: panels--page_title_does_not_display--2869412-27.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Alumei’s picture

@toodwoof

Where you ever able to get this working?

I just tried replicating you issue on a fresh site using simplytest.me.
I can not replicate it using the following steps:

  1. Create a test site with the following parameters:
  2. Enable pange manager modules
  3. Go to the pages listing & edit the 'Node view'
  4. Add panels variant
  5. Place the titleblock
  6. Configure the panels page title to contain: '[node:title]'
Alumei’s picture

Status: Needs work » Needs review

Sorry, accidentally tested against the wrong branch. retested be sure. As such back to needs review.

toddwoof’s picture

@alumei I need to test on a fresh install. For the site I was working on, I abandoned Panels and moved to the formative core layout function. Will take a test drive in another environment when I can!

NWOM’s picture

Status: Needs review » Needs work

#27 doesn't seem to work for me quite right. Rather than showing no title (before the patch), it instead shows the following raw html as a title:

<span data-quickedit-field-id="node/10/title/und/full">TITLE</span>

Idas’s picture

Are there any news about it?

rutiolma’s picture

Status: Needs work » Reviewed & tested by the community

The patch at #27 seems to work well for me.

@toddwoof, I always had to place the Page Title block in order to display the title, so maybe this is by design? It doesn't seem related with this issue and another issue should be created for this IMO.

@NWOM it seems you're using quickedit. I enabled it on my site and it doesn't cause any issue so it would be nice to get more info about that issue. Maybe theming issue?

yeaha’s picture

adjusted patch line nrs of the patch in comment #27 on branch 8.4.x

yeaha’s picture

back visible

yeaha’s picture

  • japerry committed ffb9191 on 8.x-4.x
    Issue #2869412 by Alumei, piggito, rbayliss, toddwoof: Page title does...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Did my own testing, and this seems to work for me too. Fixed!

  • japerry committed 43f74fa on 8.x-4.x
    Fix d10 compatibility for Issue #2869412.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.