src/Kunstmaan/PagePartBundle/PagePartAdmin/PagePartAdmin.php
public function getPossiblePagePartTypes()
    {
        $possiblePPTypes = $this->configurator->getPossiblePagePartTypes();
        $result = array();

        // filter page part types that can only be added x times to the page context.
        // to achieve this, provide a 'pagelimit' parameter when adding the pp type in your PagePartAdminConfiguration
        if (!empty($possiblePPTypes)) {
            foreach ($possiblePPTypes as $possibleTypeData) {
                if (array_key_exists('pagelimit', $possibleTypeData)) {
                    $pageLimit = $possibleTypeData['pagelimit'];
                    /** @var PagePartRefRepository $entityRepository */
                    $entityRepository = $this->em->getRepository('KunstmaanPagePartBundle:PagePartRef');
                    $formPPCount = $entityRepository->countPagePartsOfType(
                        $this->page,
                        $possibleTypeData['class'],
                        $this->configurator->getContext()
                    );
                    if ($formPPCount < $pageLimit) {
                        $result[] = $possibleTypeData;
                    }
                } else {
                    $result[] = $possibleTypeData;
                }
            }
        }

        return $result;
    }
public function getPossiblePagePartTypes()
    {
        $possiblePPTypes = $this->configurator->getPossiblePagePartTypes();
        $result = array();

        // filter page part types that can only be added x times to the page context.
        // to achieve this, provide a 'pagelimit' parameter when adding the pp type in your PagePartAdminConfiguration
        if (!empty($possiblePPTypes)) {
            foreach ($possiblePPTypes as $possibleTypeData) {
                if (array_key_exists('pagelimit', $possibleTypeData)) {
                    $pageLimit = $possibleTypeData['pagelimit'];
                    /** @var PagePartRefRepository $entityRepository */
                    $entityRepository = $this->em->getRepository('KunstmaanPagePartBundle:PagePartRef');
                    $formPPCount = $entityRepository->countPagePartsOfType(
                        $this->page,
                        $possibleTypeData['class'],
                        $this->configurator->getContext()
                    );
                    if ($formPPCount < $pageLimit) {
                        $result[] = $possibleTypeData;
                    }
                } else {
                    $result[] = $possibleTypeData;
                }
            }
        }

        return $result;
    }
public function getPossiblePagePartTypes ( ) { $ possiblePPTypes = $ this -> configurator -> getPossiblePagePartTypes ( ) ; $ result = array ( ) ; // filter page part types that can only be added x times to the page context. // to achieve this, provide a 'pagelimit' parameter when adding the pp type in your PagePartAdminConfiguration if ( ! empty ( $ possiblePPTypes ) ) { foreach ( $ possiblePPTypes as $ possibleTypeData ) { if ( array_key_exists ( 'pagelimit' , $ possibleTypeData ) ) { $ pageLimit = $ possibleTypeData [ 'pagelimit' ] ; /** @var PagePartRefRepository $entityRepository */ $ entityRepository = $ this -> em -> getRepository ( 'KunstmaanPagePartBundle:PagePartRef' ) ; $ formPPCount = $ entityRepository -> countPagePartsOfType ( $ this -> page , $ possibleTypeData [ 'class' ] , $ this -> configurator -> getContext ( ) ) ; if ( $ formPPCount < $ pageLimit ) { $ result [ ] = $ possibleTypeData ; } } else { $ result [ ] = $ possibleTypeData ; } } } return $ result ; }
This getter returns an array holding info on page part types that can be added to the page.
The types are filtererd here, based on the amount of page parts of a certain type that can be added to the page.

@return array
This getter returns an array holding info on page part types that can be added to the page . The types are filtererd here based on the amount of page parts of a certain type that can be added to the page .