本文整理汇总了PHP中Sonata\AdminBundle\Admin\AdminInterface::getChildren方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminInterface::getChildren方法的具体用法?PHP AdminInterface::getChildren怎么用?PHP AdminInterface::getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Admin\AdminInterface
的用法示例。
在下文中一共展示了AdminInterface::getChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
/**
* @param \Sonata\AdminBundle\Admin\AdminInterface $admin
* @param \Sonata\AdminBundle\Route\RouteCollection $collection
*/
public function build(AdminInterface $admin, RouteCollection $collection)
{
$collection->add('list');
$collection->add('create');
$collection->add('batch');
$collection->add('edit');
$collection->add('delete');
$collection->add('show');
$collection->add('export');
if ($this->manager->hasReader($admin->getClass())) {
$collection->add('history', '/audit-history');
$collection->add('history_view_revision', '/audit-history-view');
}
if ($admin->isAclEnabled()) {
$collection->add('acl', $admin->getRouterIdParameter() . '/acl');
}
// an admin can have only one level of nested child
if ($admin->getParent()) {
return;
}
// add children urls
foreach ($admin->getChildren() as $children) {
$collection->addCollection($children->getRoutes());
}
}
示例2: build
/**
* RouteBuilder that allowes slashes in the ids.
*
* @param \Sonata\AdminBundle\Admin\AdminInterface $admin
* @param \Sonata\AdminBundle\Route\RouteCollection $collection
*/
function build(AdminInterface $admin, RouteCollection $collection)
{
$collection->add('list');
$collection->add('create');
$collection->add('batch');
$collection->add('edit', $admin->getRouterIdParameter() . '/edit', array(), array('id' => '.+'));
$collection->add('delete', $admin->getRouterIdParameter() . '/delete', array(), array('id' => '.+'));
$collection->add('show', $admin->getRouterIdParameter(), array(), array('id' => '.+', '_method' => 'GET'));
// add children urls
foreach ($admin->getChildren() as $children) {
$collection->addCollection($children->getRoutes());
}
}
示例3: build
/**
* RouteBuilder that allows slashes in the ids.
*
* {@inheritDoc}
*/
function build(AdminInterface $admin, RouteCollection $collection)
{
$collection->add('list');
$collection->add('create');
$collection->add('batch', null, array(), array('_method' => 'POST'));
$collection->add('edit', $admin->getRouterIdParameter() . '/edit', array(), array('id' => '.+'));
$collection->add('delete', $admin->getRouterIdParameter() . '/delete', array(), array('id' => '.+'));
$collection->add('export');
$collection->add('show', $admin->getRouterIdParameter() . '/show', array(), array('id' => '.+', '_method' => 'GET'));
if ($admin->isAclEnabled()) {
$collection->add('acl', $admin->getRouterIdParameter() . '/acl', array(), array('id' => '.+'));
}
// add children urls
foreach ($admin->getChildren() as $children) {
$collection->addCollection($children->getRoutes());
}
}