Soma Posted October 8, 2013 Share Posted October 8, 2013 I haven't really investigated further but stumpled over this: In a multilanguage setup (3 languages) I have a hook to do thing on language fields. In a autoload module $this->addHookAfter("FieldtypeTextareaLanguage::wakeupValue", $this, "hookWakeupValue"); This results in PW calling wakeupValue() 3 times for each field. Is that because of there's 3 languages? I don't understand why this is so and wonder if that's a result of the language system? I'm not sure why this is needed and think could be avoided? It's not that the values change, it's always the same field and language values. As a result if have to implements checks to avoid getting the intense code called 3 times, it's getting clunky. Link to comment Share on other sites More sharing options...
ryan Posted October 12, 2013 Share Posted October 12, 2013 I'm not positive on this one and not at a place where I can check it just yet, but LanguageSupport does repeat several function calls for each language, and this may be one of them. Though not immediately sure why it would be (I would think it would be FieldtypeTextarea's wakupValue that gets called 3 times, not FieldtypeTextareaLanguage). It's also possibly the result of something to do with a repeater? If you add another language, is it then called 4 times? Link to comment Share on other sites More sharing options...
Shehbaz Posted May 15, 2014 Share Posted May 15, 2014 Hi, I am facing a strange issue, I needed to return images associated with the pages so I implemented the following hook, but strangely this puts the system in infinite loop. $this->addHookAfter("FieldtypePage::wakeupValue", $this, "hookWakeupValue"); To check further I removed the hook, opened the fieldtypepage.module file and in ___wakupValue function put this before return, i.e. returning $images array instead of pageArray $images = new WireArray(); foreach ($pageArray as $pg) { $images->add($pg->get("asset_image")); } return $images; This again puts the system in infinite loop, I am clueless on whats happening. The loop is working fine as I have tried returning the pageArray after loop and it works fine. $images = new WireArray(); foreach ($pageArray as $pg) { $images->add($pg->get("asset_image")); } return $pageArray; Is there anything I am missing or not aware of? Any help is really appreciated. Thanks 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