Juergen Posted November 7, 2017 Share Posted November 7, 2017 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: 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 More sharing options...
PWaddict Posted May 13, 2018 Share Posted May 13, 2018 Please check this topic: Link to comment Share on other sites More sharing options...
gebeer Posted May 14, 2018 Share Posted May 14, 2018 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 More sharing options...
PWaddict Posted May 14, 2018 Share Posted May 14, 2018 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 More sharing options...
gebeer Posted May 14, 2018 Share Posted May 14, 2018 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 More sharing options...
PWaddict Posted May 14, 2018 Share Posted May 14, 2018 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. 2 Link to comment Share on other sites More sharing options...
PWaddict Posted May 31, 2018 Share Posted May 31, 2018 On the PW 3.0.104 version we get the field labels instead of the field names on "Missing required value", "Restored previous value" and "Page unpublished because field is required" error messages. More info on GitHub. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now