3 users online. Create an account or sign in to join them.Users
Best (correct) way to get the setcion id from a field object
This is an open discussion with 2 replies, filed under General.
Search
The parent section is a setting of a field. You can get it by $this->get('parent_section'). Much easier :-) and not dependent on the administration instance.
hell yea, thanx so much :)
Create an account or sign in to comment.
Hi,
I'm trying to get the current section ID form within a Field instance
Class fieldMyfield extends Field { … protected function getSectionID() { $sm = new SectionManager(Administration::instance()); $cb = $sm->_Parent->getPageCallback(); return $sm->fetchIDFromHandle($cb['context']['section_handle']); } … }Though this works fine, I found it quite a hack and wonder if theres a bertter/faster/definite way to do it.
Kind regards, Thomas