Skip to content

piotrtheis/jelly-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jelly form based on model fields

Requirements

USAGE

Model:

  • In initialize method
$meta->form = (new Jelly_Form($meta))->fields(array('name', 'time', 'date', 'file', 'icon', 'text', 'enum', 'country'));

or bint groups

$meta->form = (new Jelly_Form($meta))
                ->group('base')
                ->fields(array('username'))
                ->group('address')
                ->fields(array('flat'));

Controller:

$this->template->content = View::factory('core/backend/empty/add.tpl')
                ->bind('errors', $errors)
                ->bind('form', $form);
        $form = $this->_mod_model->meta()->form->set_view($this->template->content);

View

  • Base usege
{foreach $form->fields() as $key => $field}
    {$field->get_label()}
    {$field->get_field()}
    {$field->get_error()}
{/foreach}
  • Bootstrap decorator
{foreach $form->fields() as $key => $field}
    {$field->bootstrap_form_group()}
{/foreach}
  • Bootstrap decorator with groups
{foreach $form->group('base')->fields() as $key => $field}
    {$field->bootstrap_form_group()}
    <br/>
{/foreach}

{foreach $form->group('address')->fields() as $key => $field}
    {$field->bootstrap_form_group()}
    <br/>
{/foreach}

{foreach $form->fields() as $key => $field}
    {$field->bootstrap_form_group()}
    <br/>
{/foreach}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published