public function __construct($name, BaseBuilder $builder)
 {
     parent::__construct($name, 'object');
     $this->setIcon('fa-edit');
     $this->setLabel('action.object.edit.label');
     $this->setRoute($builder->getBaseActionsRoute() . '_edit');
     $this->setParams(array('pk' => '{{ ' . $builder->getModelClass() . '.' . $builder->getModelPrimaryKeyName() . ' }}'));
 }
示例#2
0
 public function __construct($name, BaseBuilder $builder)
 {
     parent::__construct($name, 'object');
     $this->setIcon('fa-times');
     $this->setLabel('action.object.delete.label');
     $this->setConfirm('action.object.delete.confirm');
     $this->setCsrfProtected(true);
     $this->setRoute($builder->getObjectActionsRoute());
     $this->setParams(array('pk' => '{{ ' . $builder->getModelClass() . '.' . $builder->getModelPrimaryKeyName() . ' }}', 'action' => 'delete'));
     $this->setOptions(array('title' => 'action.object.delete.confirm', 'success' => 'action.object.delete.success', 'error' => 'action.object.delete.error', 'i18n' => 'Admingenerator'));
 }
 protected function initBuilder()
 {
     $builder = new BaseBuilder();
     $generator = $this->getMockBuilder('Admingenerator\\GeneratorBundle\\Builder\\Generator')->disableOriginalConstructor()->getMock();
     $builder->setGenerator($generator);
     $builder->setMustOverwriteIfExists(true);
     $builder->setOutputName('test.php');
     $builder->setTemplateDirs(array(__DIR__ . '/Fixtures/'));
     $builder->setVariables(array('name' => 'cedric'));
     $builder->setTemplateName($builder->getDefaultTemplateName());
     return $builder;
 }
 /**
  * (non-PHPdoc)
  * @see \Admingenerator\GeneratorBundle\Builder\BaseBuilder::getVariables()
  */
 public function getVariables()
 {
     // If credentials are not globally defined,
     // check if an action have credentials
     if (null === $this->getVariable('credentials')) {
         $this->variables->set('credentials', false);
         foreach (array_merge(array_values($this->getObjectActions()), array_values($this->getBatchActions())) as $action) {
             if ($action->getCredentials()) {
                 $this->variables->set('credentials', true);
                 break;
             }
         }
     }
     return parent::getVariables();
 }
 public function __construct($name, BaseBuilder $builder)
 {
     parent::__construct($name);
     $this->setConfirm('{% trans from "Admingenerator" %}form.delete.confirm{% endtrans %}');
     $this->setParams(array('pk' => '{{ ' . $builder->getModelClass() . '.' . $builder->getModelPrimaryKeyName() . ' }}'));
 }