当前位置: 首页>>代码示例>>PHP>>正文


PHP Container::addComponent方法代码示例

本文整理汇总了PHP中Nette\Forms\Container::addComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::addComponent方法的具体用法?PHP Container::addComponent怎么用?PHP Container::addComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Forms\Container的用法示例。


在下文中一共展示了Container::addComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: relationBuilder

 /**
  * @param string $name
  * @throws InvalidArgumentException
  * @throws NotImplementedException
  * @return EntityBuilder
  */
 public function relationBuilder($name)
 {
     $class = $this->getMetadata();
     if (!$class->hasAssociation($name)) {
         throw new InvalidArgumentException("Entity {$this->metadata->name} has no association '{$name}'.");
     }
     if (isset($this->relationBuilders[$name])) {
         return $this->relationBuilders[$name];
     }
     if ($class->isSingleValuedAssociation($name)) {
         if (!$this->container->getComponent($name, FALSE)) {
             $this->container->addComponent(new Nette\Forms\Container(), $name);
         }
         $builder = new EntityBuilder($this->container[$name], $this->mapper, $this->controlFactory, $this->em);
         if ($this->entity && ($relation = $class->getFieldValue($this->entity, $name))) {
             $builder->bindEntity($relation);
         } else {
             $builder->bindEntityType($class->getAssociationTargetClass($name));
         }
         return $this->relationBuilders[$name] = $builder;
     } else {
         throw new NotImplementedException();
     }
 }
开发者ID:kuba1999,项目名称:DoctrineForms,代码行数:30,代码来源:EntityBuilder.php

示例2: createControl

 /**
  * @param IControlConfig         $config
  * @param \Nette\Forms\Container $container
  * @throws \NForms\Exceptions\UnexpectedValueException
  * @return Forms\Controls\BaseControl
  */
 protected function createControl(IControlConfig $config, Forms\Container $container)
 {
     // Before
     if ($this->beforeControlCreateOp) {
         $this->beforeControlCreateOp->beforeCreateControl($config);
     }
     // Create
     $control = $this->controlFactory->createControl($config);
     if (!$control instanceof Forms\Controls\BaseControl) {
         throw new UnexpectedValueException("Control created by factory has to be subclass of Nette\\Forms\\Controls\\BaseControl, given " . (is_object($control) ? get_class($control) : gettype($control)) . ".");
     }
     $container->addComponent($control, $config->getComponentName());
     // Set attributes
     if (($placeholder = $config->getPlaceholder()) !== NULL) {
         $placeholder = $control->translate($placeholder);
         $control->controlPrototype->addAttributes(array('placeholder' => $placeholder));
     }
     if (($description = $config->getDescription()) !== NULL) {
         $control->setOption('description', $description);
     }
     $control->controlPrototype->addAttributes($config->getAttributes());
     $control->setRequired($config->getRequired());
     // After
     if ($this->afterControlCreateOp) {
         $this->afterControlCreateOp->afterCreateControl($control, $config);
     }
     // Add control to groups
     foreach ($config->getGroups() as $groupConfig) {
         $group = self::getControlGroup($container, $groupConfig);
         $group->add($control);
     }
     return $control;
 }
开发者ID:mike227,项目名称:n-forms,代码行数:39,代码来源:ContainerBuilder.php

示例3: addComponent

 /**
  * @param \Nette\ComponentModel\IComponent $component
  * @param $name
  * @param null $insertBefore
  * @return \Nette\ComponentModel\Container|\Nette\Forms\Container
  */
 public function addComponent(Nette\ComponentModel\IComponent $component, $name, $insertBefore = NULL)
 {
     $group = $this->currentGroup;
     $this->currentGroup = NULL;
     parent::addComponent($component, $name, $insertBefore);
     $this->currentGroup = $group;
     return $this;
 }
开发者ID:JedenWeb,项目名称:Replicator,代码行数:14,代码来源:Container.php

示例4: addEditorSelector

 /**
  * @param Forms\Container $container
  * @param string $name
  * @param RepositoryContainer $orm
  * @param NULL|bool $editable
  */
 public static function addEditorSelector(Forms\Container $container, $name, RepositoryContainer $orm, $editable = FALSE)
 {
     $container->addComponent(new self($orm, $editable), $name);
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:10,代码来源:EditorSelector.php

示例5: addContainer

 /**
  * @param Nette\Forms\Container $parent
  * @param string $name
  * @param IFormEntity|NULL $entity
  * @return Container
  */
 protected function addContainer(Nette\Forms\Container $parent, $name, IFormEntity $entity = NULL)
 {
     $container = $this->getContainerFactory($name)->create($entity);
     $parent->addComponent($container, $name);
     return $container;
 }
开发者ID:sw2eu,项目名称:form-factory,代码行数:12,代码来源:TContainerHandler.php


注:本文中的Nette\Forms\Container::addComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。