Jump to content

Is it possible to hook into message render function


Juergen
 Share

Recommended Posts

Hello @ all,

It want to change the markup of the notices (error, warning, message) a little bit. By default error messages in the admin look like this:

screenshot-www.juergen-kern.at-2017-11-07-10-23-13.png.21200bd70fa0895f1505b3b87614c366.png

 

There is the hint that a field is required and next to this message is the name of the field in parenthesis. This is the point, where I like to hook into.

I want to replace the name of the field by the field label because editors dont know what the name of the field is. So if the user is not superuser this hook should take place.

It is not a thing that is very important to me, but if there is a render function of the messages that will be hookable, it would be great if someone can tell me about.

I have taken a look at https://processwire.com/api/hooks/captain-hook/ but I cannot find anything so maybe it will not be possible. But who knows....

 

Link to comment
Share on other sites

  • 6 months later...

If you don't want to change the core Inputfield.php that @PWaddict points to, you can copy the whole Inputfield module folder to site/modules and apply your changes there. When you then refresh the modules in the backend PW will ask you from which location the module should be loaded.

Link to comment
Share on other sites

3 hours ago, gebeer said:

If you don't want to change the core Inputfield.php that @PWaddict points to, you can copy the whole Inputfield module folder to site/modules and apply your changes there. When you then refresh the modules in the backend PW will ask you from which location the module should be loaded.

Isn't possible with a hook?

Link to comment
Share on other sites

2 minutes ago, PWaddict said:

Isn't possible with a hook?

don't think so since the error method is not hookable nor is any other method in that class that would give you access to what you need. 

Link to comment
Share on other sites

1 minute ago, gebeer said:

don't think so since the error method is not hookable nor is any other method in that class that would give you access to what you need. 

Then I think I'm gonna post it as an issue on GitHub since non-superusers shouldn't see the field names.

  • Like 2
Link to comment
Share on other sites

  • 3 weeks later...

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...