Log in

13net

It's easy to think we can just use up all the internet we want, but if we don't treat it with the respect that it deserves, it could one day be gone forever.

Stats

  • Category: Uncategorized
  • License: GNU General Public License (GPL) version 2
  • Updated: 2012-2-29
  • Downloads: 855
  • Recommendations: 3

Releases

Other Projects

View 13net's plugins

[PHLOOR STARTER] Entity for Elgg 1.8

Phloor Starter Kit: How to create your own entity.

Last updated 790 days ago

This plugin is for demonstration purposes only. It will get you started on how to create and manage your own Entity type with the phloor framework.

All in all it consists of ~100 lines of actual php code (without comments and language strings)! You will see how easy it is to create your own entity type using phloor.

Reuqirements

  • PHP version 5.3.0 or above
  • phloorFramework 1.8.3 or above (currently phloor 1.8.3rc3)

This example is kept short and simple and just for your understanding of the inner mechanismns of phloor - it will only show you the minimum of whats possible to create your own entity.

If you want to see more sophisticated examples view the 1.8.3 versions of the following plugins:

  • phloorMenuitem
  • phloorNews

 

An entity controlled by phloor is automatically able to be: created/edited/deleted/viewed/listed! Everything from routing and displaying the pages 'all', 'owner', 'friends', 'edit', 'add', 'view' to defining the create/update/delete actions is done by phloor.

The only thing you need to do is:

  • create a class extending ElggObject
  • implement at least 'default_vars' and 'form_vars' hook

You will not lose the flexibility given to you by Elgg since you can always take the whole control over your entity back. You can also implement partial things which would otherwise be automatically handled by phloor - but that will not be covered in this plugin.

Attributes of the starter ENTITY are:

  • title: a custom title
  • description: a custom description
  • tags: a comma seperated list of tags
  • comments_on: turn comments off/on
  • access_id: read access

It uses the following phloors entity object hooks:

  • 'phloor_object:default_vars',      'phloor_starter_ENTITY'
  • 'phloor_object:form_vars',         'phloor_starter_ENTITY'
  • 'phloor_object:prepare_form_vars', 'phloor_starter_ENTITY'
  • 'phloor_object:check_vars',        'phloor_starter_ENTITY'

Languages

  • English

Any suggestions are very welcome. Dont hesitate to ask questions!

Release Notes:

/** * @version 1.8.3-12.02.22b */

  • adapted basic hooks