public function childfilter($request)
    {
        // Check valid parent specified
        $parentID = $request->requestVar('ParentID');
        $parent = SiteTree::get()->byID($parentID);
        if (!$parent || !$parent->exists()) {
            return $this->httpError(404);
        }

        // Build hints specific to this class
        // Identify disallows and set globals
        $classes = SiteTree::page_type_classes();
        $disallowedChildren = array();
        foreach ($classes as $class) {
            $obj = singleton($class);
            if ($obj instanceof HiddenClass) {
                continue;
            }

            if (!$obj->canCreate(null, array('Parent' => $parent))) {
                $disallowedChildren[] = $class;
            }
        }

        $this->extend('updateChildFilter', $disallowedChildren, $parentID);
        return $this
            ->getResponse()
            ->addHeader('Content-Type', 'application/json; charset=utf-8')
            ->setBody(json_encode($disallowedChildren));
    }
public function childfilter($request)
    {
        // Check valid parent specified
        $parentID = $request->requestVar('ParentID');
        $parent = SiteTree::get()->byID($parentID);
        if (!$parent || !$parent->exists()) {
            return $this->httpError(404);
        }

        // Build hints specific to this class
        // Identify disallows and set globals
        $classes = SiteTree::page_type_classes();
        $disallowedChildren = array();
        foreach ($classes as $class) {
            $obj = singleton($class);
            if ($obj instanceof HiddenClass) {
                continue;
            }

            if (!$obj->canCreate(null, array('Parent' => $parent))) {
                $disallowedChildren[] = $class;
            }
        }

        $this->extend('updateChildFilter', $disallowedChildren, $parentID);
        return $this
            ->getResponse()
            ->addHeader('Content-Type', 'application/json; charset=utf-8')
            ->setBody(json_encode($disallowedChildren));
    }
public function childfilter ( $ request ) { // Check valid parent specified $ parentID = $ request -> requestVar ( 'ParentID' ) ; $ parent = SiteTree :: get ( ) -> byID ( $ parentID ) ; if ( ! $ parent || ! $ parent -> exists ( ) ) { return $ this -> httpError ( 404 ) ; } // Build hints specific to this class // Identify disallows and set globals $ classes = SiteTree :: page_type_classes ( ) ; $ disallowedChildren = array ( ) ; foreach ( $ classes as $ class ) { $ obj = singleton ( $ class ) ; if ( $ obj instanceof HiddenClass ) { continue ; } if ( ! $ obj -> canCreate ( null , array ( 'Parent' => $ parent ) ) ) { $ disallowedChildren [ ] = $ class ; } } $ this -> extend ( 'updateChildFilter' , $ disallowedChildren , $ parentID ) ; return $ this -> getResponse ( ) -> addHeader ( 'Content-Type' , 'application/json; charset=utf-8' ) -> setBody ( json_encode ( $ disallowedChildren ) ) ; }
Callback to request the list of page types allowed under a given page instance.
Provides a slower but more precise response over SiteTreeHints

@param HTTPRequest $request
@return HTTPResponse
Callback to request the list of page types allowed under a given page instance . Provides a slower but more precise response over SiteTreeHints