PHP code example of hypejunction / hypeprototyperui
1. Go to this page and download the library: Download hypejunction/hypeprototyperui library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hypejunction / hypeprototyperui example snippets
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'),
),
));
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);
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;
}
$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
));
$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();