3 users online. Create an account or sign in to join them.Users

Search

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

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details