Currently, in Panelizer we have to do this super awkward incantation to set the page title in PanelizerNode:

    $configuration = $panels_display->getConfiguration();
    $configuration['page_title'] = '[node:title]';
    $panels_display->setConfiguration($configuration);

We're going to have to do this for pretty much every PanelizerEntity plugin we make.

Let's add a setter method for this! I propose setPageTitle() (and let's do getPageTitle() too for completeness).

CommentFileSizeAuthor
#5 2664614-5.patch832 bytesphenaproxima
#3 2664614-3.patch926 bytesphenaproxima

Comments

dsnopek created an issue. See original summary.

dsnopek’s picture

Title: Add a setting to PanelsDisplayVariant for setting the page title » Add a setter to PanelsDisplayVariant for setting the page title
Issue summary: View changes
phenaproxima’s picture

Status: Active » Needs review
StatusFileSize
new926 bytes
dsnopek’s picture

Thanks!

  1. +++ b/src/Plugin/DisplayVariant/PanelsDisplayVariant.php
    @@ -253,6 +253,30 @@ class PanelsDisplayVariant extends BlockDisplayVariant {
    +    return $this->getConfiguration()['page_title'];
    

    Since we're inside this class, it should be safe to do return $this->configuration['page_title']

  2. +++ b/src/Plugin/DisplayVariant/PanelsDisplayVariant.php
    @@ -253,6 +253,30 @@ class PanelsDisplayVariant extends BlockDisplayVariant {
    +    $configuration = $this->getConfiguration();
    +    $configuration['page_title'] = $title;
    +    $this->setConfiguration($configuration);
    +    return $this;
    

    For the same reason, it should be safe to simply do $this->configuration['page_title'] = $title

phenaproxima’s picture

StatusFileSize
new832 bytes

True dat.

dsnopek’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me! Thanks!

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Pretty simple and useful piece. Added!

dsnopek’s picture

Awesome, thanks!

The last submitted patch, 3: 2664614-3.patch, failed testing.

Status: Fixed » Needs work

The last submitted patch, 5: 2664614-5.patch, failed testing.

dsnopek’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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