Skip to content

Commit

Permalink
Add api file and correct README. (#50)
Browse files Browse the repository at this point in the history
* Add api file and correct README.

* typo.
  • Loading branch information
rosiel authored and DiegoPino committed Nov 6, 2017
1 parent 417742e commit 7fd8ec0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Introduction

The Objective Forms module contains a series of functions and classes that allow Drupal forms to be treated as Fedora objects. It provides back-end support to XML Forms so that Drupal's built-in form functions and classes can be used when filling out metadata.
The Objective Forms module contains a series of functions and classes that allow Drupal forms to be treated as PHP objects. It provides back-end support to XML Forms so that Drupal's built-in form functions and classes can be used when filling out metadata.

Some important notes:

* Each form element is assigned a unique hash Form Property to identify it, as #hash.
* Each form element that is created is stored in a registry, and it will persist though out the lifetime of the form even if it's removed from the form. Ancestry of Form Elements is stored, so if a Form Element is cloned we will be able to determine the Form Element that is was cloned from.
* Form Properties can be objects. To define new Form Properties, implement the hook `objectify_properties`.
* Forms will be auto-populated from `$form_states['values']`.
* Forms will be auto-populated from `$form_state['values']`.
* There is a FormStorage class that can be used to store any persistent data.

## Requirements
Expand Down
28 changes: 28 additions & 0 deletions objective_forms.api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @file
* This file documents hooks provided by Objective Forms.
*/

/**
* Define a custom Drupal form property.
*
* @return array
* Returns an associative array mapping property names to associative
* arrays with all the data required to build a FormProperty class:
* - "type": The type (file extension) of the file to include, e.g. "inc".
* - "module": The machine name of the module where the code is located.
* - "name": The name of the file, including its path within the module.
* - "class": The name of the class defining the property.
*/
function hook_objectify_properties() {
return array(
'#actions' => array(
'type' => 'inc',
'module' => 'module_name',
'file' => 'includes/FileName',
'class' => 'ClassName',
),
);
}

0 comments on commit 7fd8ec0

Please sign in to comment.