them / frog_page_metadata

Plug-in for Frog CMS to add metadata to the pages

This URL has Read+Write access

README.markdown

About

This is a simple plugin for the Frog CMS. It adds the ability to add more metadata to a page object.

Motivation

I'm currently writing on a plugin that needs extra, custom metadata for a page. I didn't want to create a specific database table, so I contribute this generic plugin that can be used to store generic metadata for a page.

Requirements

Install

Protect your plugins. Edit config.php and add the following line:

define('IN_FROG', true);

Copy plugin files to frog/plugins/page_metadata/ folder.

cd frog/plugins/
git clone git://github.com/them/frog_page_metadata.git page_metadata

Usage

The 'visible' part of the plugin adds another tab to the page view: the 'More Metadata' tab. With this dialog any metadata (keyword value pairs) can be added to an existing page. If the value left blank, the metadata gets removed

Getter

The 'PageMetadata' exports the following static functions:

  • FindAllByPage provide the page or page_id as parameter.
  • FindAllByPageAsArray same as above, but returns a simple PHP array
  • FindOneByPageAndKeyword returns the value or false for this page and keyword (NOTE: no caching is applied to this function. Ideally use it only once)

NOTE: inside a view the page object is the '$this' reference.

Extensibility

Because the plugin was generated as a helper plugin for other plugins, the plugin can be extended as well.

Observers

The Frog CMS offers an observer mechanism to extend the core. The 'PageMetadata' plugin exports the following subscribable 'topic':

view_page_page_metadata with the page as parameter.

Visibility

If the metadata has the 'visibility' of '0', the user is not able to alter the metadata directly. This value should be manipulated (e.g. select box) by another plugin that is using the 'observer topic'.