Jorge Robles Posted February 11, 2013 Share Posted February 11, 2013 Hi all: I've been trying to do a Textformatter based on Wordpress like Shortcodes module, but this textformatter should add a description of what shortcodes are enabled, to every field that has itself attached, in admin area. Documentation on Textformatter class tells that init() is fired when PW is ready, but seems TextFormatters are only init'd upon content rendering (i.e. frontend) instead. What's the way to go? Thanks in advance! Link to comment Share on other sites More sharing options...
Jorge Robles Posted February 11, 2013 Author Share Posted February 11, 2013 Maybe Modules could implement a TextformatterInterface instead, so any module could act as a Textformatter, and also provide the standard behavior? Link to comment Share on other sites More sharing options...
apeisa Posted February 11, 2013 Share Posted February 11, 2013 Maybe implement two modules. One textformatter and another autoload module which looks for fields that have the certain textformatter. Link to comment Share on other sites More sharing options...
Jorge Robles Posted February 11, 2013 Author Share Posted February 11, 2013 Yes. I've seen that way before, but the idea of making another module is not very appealing for me (in this case). Thank you! Link to comment Share on other sites More sharing options...
Soma Posted February 11, 2013 Share Posted February 11, 2013 Texformatter modules aren't autoload they only get called when needed. You'd have to make it autoload to use the init in the backend, but then it's not when it's called but when autoloaded in the admin. Then you could use init to add a hook InputfieldText::render there for fields that use that this textformatter. 2 Link to comment Share on other sites More sharing options...
Jorge Robles Posted February 11, 2013 Author Share Posted February 11, 2013 Yes, Sir! I missed the autoload flag in the Module. Now it works beautifully! Thank you guys! 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