Jump to content

[SOLVED] No title field with Add New Page in PW anymore after hideTitle true


Klenkes
 Share

Recommended Posts

After reviewing RPB for a long time(and having a few issues) I now decided to use it in projects.
But now... problems show up and I don't know how to approach this.

Setup:
A Onepager, SPA
A few RPB fields like rockpagebuilder_events or rockpagebuilder_news ... with blocks assigned.
RPB 5.0.3 PW 3.0.229

In this setup I don't need the title field in my blocks, so I sett them all to 'hideTitle' => true
It worked.
Some time after that I noticed that when adding a new PW page with no RPB blocks, just a simple PW for imprint or privacy ploicy, only the name field shows up, no title field:

image.png.1173cf784c3ee1c20dee5c4a82e3200f.png

Even when creating a new template no default title is added.
After generating a name and saving the new page no error about the required title is thrown. The page will be created with an empty title! After that the title fie3ld is shown.

I commented out //hideTitle => true in a all blocks, but the problem remains.

I manually deleted all cached and compiled files and now I am puzzled with this.
No additional hooks or anything.
Where do I look? What to do? How do I go about this?

Could be connected to another problem I will post next.

  • Thanks 1
Link to comment
Share on other sites

Thx for the report. I'm sure we'll be able to fix your problems!

First of all it's weird what you experiencing. I've never seen this and I can't explain how that should even be possible. Have a look at what hideTitle does:

  /**
   * Hide title field if block has setting "hideTitle"
   */
  public function hookHideTitleField(HookEvent $event)
  {
    $block = $event->process->getPage();
    if (!$block instanceof Block) return;
    if (!$block->getInfo()->hideTitle) return;
    $event->return->remove('title');
  }

So for a quick test you could just add a "return" at the very top of this method in RockPageBuilder.module.php

Let me know what happened ? 

Are you using RockMigrations or are you doing everything with the GUI?

  • Like 1
Link to comment
Share on other sites

Thanks.
Ich will check this out.

No GUI, I am using RockMigration with the complete migration code in all the blocks. For an easy reusing blocks in other projects.

Link to comment
Share on other sites

Just now, Klenkes said:

No GUI, I am using RockMigration with the complete migration code in all the blocks. For an easy reusing blocks in other projects.

??

10 minutes ago, Klenkes said:

I commented out //hideTitle => true in a all blocks, but the problem remains.

I'm not sure about this one. Often when working with RockMigrations REMOVING things is not enough. For example if you have set a "description" or a "notes" property of a field and then remove it, the value will still be in the DB. So you need to set it to an empty string to remove it.

I don't think that "hideTitle" is stored in the DB though. So it should be fine to comment it out here. But what you can do is change it to "false" and try if that makes a difference.

Link to comment
Share on other sites

12 minutes ago, bernhard said:

So for a quick test you could just add a "return" at the very top of this method in RockPageBuilder.module.php

Unfortunately, no luck. (with module refresh, delete compiled files and the whole shebang)

Link to comment
Share on other sites

20 minutes ago, Klenkes said:

Even when creating a new template no default title is added.

Ok I can reproduce this so I'll have a look into this instantly! I'll be back ? 

  • Like 1
Link to comment
Share on other sites

Yeah I don't think it has anything to do with that setting. It's related to RockMigrations I guess. I'm already searching and just killed my current project by disabling autoload for RockMigrations. Not a good idea if you are using MagicPages because then nothing will be usable any more, no frontend, no backend ? 

I had to add this at the very top of index.php and then enable autoload back to normal:

require_once __DIR__ . "/site/modules/RockMigrations/classes/MagicPage.php";

Maybe someone finds this info helpful some day ? 

  • Like 1
Link to comment
Share on other sites

Ok first bug will be fixed in the next release. The field hints for rockmigrations messed up the field select, so if you saw something like the below that's history ? 

lxtTLKn.png

I'm working on the issue with having no title field now as that is something else unfortunately ? 

  • Thanks 1
Link to comment
Share on other sites

  • Installed RockMigrations - all good
  • Installed RockPageBuilder (+RockFrontend) - all good
  • Installed Accordion Demo Block - all good
  • Installed TracyDebugger - all good

Do you have any other Rock modules installed on that website?

Link to comment
Share on other sites

Ok this one is a very easy fix for everyone experiencing this! Just make sure that the title field has the global flag enabled:

9cApByw.png

I don't know why or when it loses that flag yet, but I have it on 2 projects so it seems to be an issue. It would be nice to get some feedback if anybody else is experiencing this as well?

  • Thanks 1
Link to comment
Share on other sites

21 minutes ago, Denis Schultz said:

I had the same issue and fixed it in the same way last year - i thought i changed the setting and was responsive for it - so i didn't report it.

Thx for the report! And since then no issues any more?

Link to comment
Share on other sites

Could you @Klenkes and @Denis Schultz please install RockMigrations v3.35.3 (latest release on the main branch)? That will add a check for the title's flags on every run of migrations and log some information to the log and show a warning on the backend. If that happens it would be great if you can report what you did and when it happened and maybe share some informations from the log!

Link to comment
Share on other sites

12 minutes ago, bernhard said:

Thx for the report! And since then no issues any more?

I had it on two installation in the past (Nov/Dez timeframe). But then not more. Both had RockMigrations, one had RockFronted - but they didn't had/have RockPageBuilder.

  • Thanks 1
Link to comment
Share on other sites

I don't know if it belongs here, but i installed .5 and get some log with markup error in the log view, where the html notation gets showed in the url col (and the link is also broken):

image.thumb.png.7779a9ad233ab12e1577ce76c8a3f722.png

 

Aside from that, everything is smooth. I was too slow for testing with .4 and your check ?

Link to comment
Share on other sites

1 hour ago, bernhard said:

Update: Ok showing the error message was a good idea. I can now reproduce the issue. For me it happens when I remove the title field from a RPB block.

Exactly. It has nothing to do with hideTitle, it's removing the title field from a block.
With RM 3.35.5 the error is shown.

Link to comment
Share on other sites

Ok great, I found the issue and now everything makes sens! ???

Please grab the latest release of RockPageBuilder here https://www.baumrock.com/en/releases/rockpagebuilder/ and also upgrade RockMigrations to v3.35.5

The Problem was the removeFieldFromTemplate() method in RockMigrations. This method also removed global fields from any template if the "force" parameter was true. This operation made the title field non-global, which led to the problems we were seeing. Which makes sense now.

Usually it's very unlikely that this ever happened but when working with RockPageBuilder you often have blocks that don't need a title field. That's the same for repeater fields, so I explored how it is done there. It would not be ProcessWire if there was not already a solution for it ? So I learned that every template has a "noGlobal" flag that you can enable and if that flag is enabled then global fields will not be added on template creation and it will also make sure that the RPB blocks don't make any problems if you remove any global field (eg the title field).

That's a great update and makes RockMigrations a lot better. Thx for the reports and help with Debugging!

Enjoy the new release and please mark the topic as solved ? 

  • Like 1
Link to comment
Share on other sites

  • Klenkes changed the title to [SOLVED] No title field with Add New Page in PW anymore after hideTitle true

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...