2017 © Pedro Peláez
 

elgg-plugin hypeprototyperui

Entity prototyping

image

hypejunction/hypeprototyperui

Entity prototyping

  • Wednesday, September 2, 2015
  • by hypeJunction
  • Repository
  • 2 Watchers
  • 0 Stars
  • 150 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

hypePrototyperUI

Elgg 1.8 Elgg 1.9 Elgg 1.10 Elgg 1.11, (*1)

User Interface for hypePrototyper, (*2)

Introduction

The plugin allows developers to present a visual UI for construction forms. This can be useful, when working with volatile entity types that will require admin/user modifications over time., (*3)

alt text alt text, (*4)

Requirements

Even though this plugins runs on 1.8, your theme will need to support jQuery 1.7+., (*5)

How to Use

Display the UI

Let's assume you have an action to create/edit new books, e.g. books/save. You may want to differentiate what forms to display, based on what library this book is available in., (*6)

Register an action that will take care of storing the form config, e.g. books/prototype/save., (*7)


echo elgg_view_form('prototyper/edit', array( 'action' => 'books/prototype/save', ), array( 'action' => 'books/save', 'attributes' => array( 'type' => 'object', 'subtype' => 'book', 'access_id' => ACCESS_PUBLIC, 'container_guid' => $library_guid, ), 'params' => array( 'layout' => array('main', 'sidebar', 'footer'), ), ));

Save config

Perhaps the easiest is to store the config as metadata on a library. You can also use plugin settings, annotations or any method that will allow you to retrieve the config to feed into the plugin hook., (*8)

In books/prototype/save, save your config:, (*9)


use hypeJunction\Prototyper\UI\Template; $container_guid = get_input('container_guid'); $library = get_entity($container_guid); $prototype = hypePrototyper()->ui->buildPrototypeFromInput(); $library->book_prototype = json_encode($prototype);

Hook into the prototype


elgg_register_plugin_hook_handler('prototype', 'books/save', 'book_form'); function book_form($hook, $type, $return, $params) { $book = elgg_extract('entity', $params); if (elgg_instanceof($book, 'object', 'book')) { $library = $entity->getContainerEntity(); if ($library->book_prototype) { return json_decode($library->book_prototype, true); } } return $return; }

Display the form


$book = elgg_extract('entity', $vars); $library = elgg_extract('container', $vars); $attributes = array( 'guid' => $book->guid, 'type' => 'object', 'subtype' => 'book', 'container_guid' => $library->guid, ); $body = hypePrototyper()->form->with($attributes, 'books/save')->viewBody(); $body .= elgg_view('input/submit', array( 'value' => elgg_echo('save') )); echo elgg_view('input/form', array( 'action' => 'action/books/save', 'body' => $body ));

Handle the form

Now in your action file, all you need to do is use:, (*10)


$guid = get_input('guid'); $attributes = array( 'guid' => $guid, 'type' => 'object', 'subtype' => 'book', 'container_guid' => get_input('container_guid'), ); hypePrototyper()->action->with($attributes, 'books/save')->handle();

The Versions

02/09 2015

5.x-dev

5.9999999.9999999.9999999-dev http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

28/08 2015

dev-dev

dev-dev http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

28/08 2015

4.5.0

4.5.0.0 http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

24/08 2015

4.4.0

4.4.0.0 http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

24/08 2015

4.3.0

4.3.0.0 http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

11/08 2015

4.2.0

4.2.0.0 http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

11/08 2015

4.1.0

4.1.0.0 http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes

11/08 2015

dev-master

9999999-dev http://hypejunction.com

Entity prototyping

  Sources   Download

GPL-2.0

The Development Requires

by Ismayil Khayredinov

plugin forms elgg prototypes