コード例 #1
0
 /**
  * Define the form fields.
  *
  * @param Form $form The Windwalker form object.
  *
  * @return  void
  */
 public function define(Form $form)
 {
     $loginName = WarderHelper::getLoginName();
     $langPrefix = WarderHelper::getPackage()->get('frontend.language.prefix', 'warder.');
     $form->wrap('basic', null, function (Form $form) use($loginName, $langPrefix) {
         $form->add('name', new Field\TextField())->label(Translator::translate($langPrefix . 'user.field.name'))->required();
         if (strtolower($loginName) != 'email') {
             $form->add($loginName, new Field\TextField())->label(Translator::translate($langPrefix . 'user.field.' . $loginName))->setValidator(new UserExistsValidator($loginName))->required();
         }
         $form->add('email', new Field\EmailField())->label(Translator::translate($langPrefix . 'user.field.email'))->setValidator(new UserExistsValidator('email'))->required();
         $form->add('password', new Field\PasswordField())->label(Translator::translate($langPrefix . 'user.field.password'))->set('autocomplete', 'off');
         $form->add('password2', new Field\PasswordField())->label(Translator::translate($langPrefix . 'user.field.password.confirm'))->set('autocomplete', 'off');
         $form->add('avatar', new SingleImageDragField())->label('Avatar')->set('default_image', AvatarUploadHelper::getDefaultImage());
     });
 }
コード例 #2
0
ファイル: EditDefinition.php プロジェクト: asika32764/natika
 /**
  * Define the form fields.
  *
  * @param Form $form The Windwalker form object.
  *
  * @return  void
  */
 public function define(Form $form)
 {
     $langPrefix = LunaHelper::getLangPrefix();
     // Title
     $form->add('title', new Field\TextField())->label(Translator::translate($langPrefix . 'article.field.title'))->set('placeholder', Translator::translate($langPrefix . 'article.field.title'))->setFilter('trim')->required(true);
     // Alias
     $form->add('alias', new Field\TextField())->label(Translator::translate($langPrefix . 'article.field.alias'))->set('placeholder', Translator::translate($langPrefix . 'article.field.alias'));
     // Basic fieldset
     $form->wrap('basic', null, function (Form $form) use($langPrefix) {
     });
     // Text Fieldset
     $form->wrap('text', null, function (Form $form) use($langPrefix) {
         // Introtext
         $form->add('body', new SummernoteEditorField())->label(Translator::translate($langPrefix . 'article.field.introtext'))->set('options', array('height' => 450))->set('rows', 10);
     });
     // Created fieldset
     $form->wrap('created', null, function (Form $form) use($langPrefix) {
         // Title
         $form->add('short_title', new Field\TextField())->label('Short Title')->set('placeholder', 'Short Title')->setFilter('trim');
         // URL
         $form->add('url', new Field\TextField())->label('URL')->set('placeholder', 'URL')->set('class', 'validation-url')->setFilter('trim');
         // State
         $form->add('state', new Field\RadioField())->label(Translator::translate($langPrefix . 'article.field.state'))->set('class', 'btn-group')->set('default', 1)->addOption(new Option(Translator::translate('phoenix.grid.state.published'), '1'))->addOption(new Option(Translator::translate('phoenix.grid.state.unpublished'), '0'));
         // ID
         $form->add('id', new Field\HiddenField());
         // Icon
         $form->add('icon', new IconFontAwesomeModalField())->label('Icon');
         // Created
         $form->add('created', new Phoenix\Field\CalendarField())->label(Translator::translate($langPrefix . 'article.field.created'));
         // Modified
         $form->add('modified', new Phoenix\Field\CalendarField())->label(Translator::translate($langPrefix . 'article.field.modified'))->disabled();
         if (WarderHelper::tableExists('users')) {
             // Author
             $form->add('created_by', new UserModalField())->label(Translator::translate($langPrefix . 'article.field.author'));
             // Modified User
             $form->add('modified_by', new UserModalField())->label(Translator::translate($langPrefix . 'article.field.modifiedby'))->readonly();
         }
     });
 }
コード例 #3
0
ファイル: ForumPackage.php プロジェクト: asika32764/natika
 /**
  * loadRouting
  *
  * @return  array|mixed
  */
 public function loadRouting()
 {
     $routes = parent::loadRouting();
     $routes = array_merge($routes, WarderHelper::getFrontendRouting());
     return $routes;
 }
コード例 #4
0
ファイル: AdminPackage.php プロジェクト: asika32764/natika
 /**
  * loadRouting
  *
  * @return  mixed
  */
 public function loadRouting()
 {
     $routes = parent::loadRouting();
     foreach (Folder::files(__DIR__ . '/Resources/routing') as $file) {
         if (File::getExtension($file) == 'yml') {
             $routes = array_merge($routes, (array) Yaml::parse(file_get_contents($file)));
         }
     }
     // Merge other routes here...
     $routes = array_merge($routes, WarderHelper::getAdminRouting());
     $routes = array_merge($routes, LunaHelper::getAdminRouting());
     return $routes;
 }