hypejunction/hypepost

Utility plugin for quick prototyping of content posts

Installs: 11

Dependents: 1

Suggesters: 0

Stars: 1

Watchers: 1

Forks: 1

Type:elgg-plugin

1.9.2 2019-06-25 13:26 UTC

README

Provides utilities for creating and editing posts.

Extendable form fields Post forms are built using an extended field API layer, which makes it easier to define all fields in one place, and not have to worry about maintaining form, action and profile logic separate from each other.

Reusable views Plugins can recycle existing resource views, saving lots of time needed to bootstrap new entity types.

Client site validation Client side form validation

AJAX form save Forms are saved using AJAX with saves user a few steps should the action fail.

Form Fields

To extend post form, use fields, <entity_type>:<entity_subtype> (or less granular fields, <entity_type> ) plugin hook.

The hook receives an instance of \hypeJunction\Fields\Collection, which allows you to easily manipulate fields:

elgg_register_plugin_hook_handler('fields', 'object:blog', function(\Elgg\Hook $hook) {

	$fields = $hook->getValue();
	/* @var $fields \hypeJunction\Fields\Collection */
	
	$fields->add('published_date', new MetaField([
		'type' => 'date',
		'required' => true,
	]);
	
	$fields->get('description')->required = false;
	
	return $fields;
});

Features

Icons

To enable or disable icons, use uses:icon, <entity_type>:<entity_subtype> hook. The handler should return true or false

Cover Images

To enable or disable cover images, use uses:cover, <entity_type>:<entity_subtype> hook. The handler should return true or false

Comments

To enable or disable comments, use uses:comments, <entity_type>:<entity_subtype> hook. The handler should return true or false