當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::addTextarea方法代碼示例

本文整理匯總了PHP中Nette\Forms\Container::addTextarea方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::addTextarea方法的具體用法?PHP Container::addTextarea怎麽用?PHP Container::addTextarea使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Forms\Container的用法示例。


在下文中一共展示了Container::addTextarea方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addToFormContainer

 /**
  * Get assambled form
  * @param Nette\Forms\Container $container
  * @return void
  */
 public function addToFormContainer($container)
 {
     /** @var Nette\Application\UI\Form $form */
     $form = $container->lookup('Nette\\Application\\UI\\Form');
     $translator = $form->getTranslator();
     $main_options = [];
     /**
      * First foreach for filling "main" select
      */
     foreach ($this->group_actions as $id => $action) {
         $main_options[$id] = $action->getTitle();
     }
     $container->addSelect('group_action', '', $main_options)->setPrompt('ublaboo_datagrid.choose');
     /**
      * Second for creating select for each "sub"-action
      */
     foreach ($this->group_actions as $id => $action) {
         $control = NULL;
         if ($action instanceof GroupSelectAction) {
             if ($action->hasOptions()) {
                 $control = $container->addSelect($id, '', $action->getOptions());
                 $control->setAttribute('id', static::ID_ATTRIBUTE_PREFIX . $id);
             }
         } else {
             if ($action instanceof GroupTextAction) {
                 $control = $container->addText($id, '');
                 $control->setAttribute('id', static::ID_ATTRIBUTE_PREFIX . $id)->addConditionOn($container['group_action'], Form::EQUAL, $id)->setRequired($translator->translate('ublaboo_datagrid.choose_input_required'))->endCondition();
             } else {
                 if ($action instanceof GroupTextareaAction) {
                     $control = $container->addTextarea($id, '');
                     $control->setAttribute('id', static::ID_ATTRIBUTE_PREFIX . $id)->addConditionOn($container['group_action'], Form::EQUAL, $id)->setRequired($translator->translate('ublaboo_datagrid.choose_input_required'));
                 }
             }
         }
         if ($control) {
             /**
              * User may set a class to the form control
              */
             if ($class = $action->getClass()) {
                 $control->setAttribute('class', $class);
             }
             /**
              * User may set additional attribtues to the form control
              */
             foreach ($action->getAttributes() as $name => $value) {
                 $control->setAttribute($name, $value);
             }
         }
     }
     foreach ($this->group_actions as $id => $action) {
         $container['group_action']->addCondition(Form::EQUAL, $id)->toggle(static::ID_ATTRIBUTE_PREFIX . $id);
     }
     $container['group_action']->addCondition(Form::FILLED)->toggle(strtolower($this->datagrid->getName()) . 'group_action_submit');
     $container->addSubmit('submit', 'ublaboo_datagrid.execute')->setAttribute('id', strtolower($this->datagrid->getName()) . 'group_action_submit');
     if ($form instanceof Nette\ComponentModel\IComponent) {
         $form->onSubmit[] = [$this, 'submitted'];
     }
 }
開發者ID:ublaboo,項目名稱:datagrid,代碼行數:63,代碼來源:GroupActionCollection.php


注:本文中的Nette\Forms\Container::addTextarea方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。