Structures_Form
[ class tree: Structures_Form ] [ index: Structures_Form ] [ all elements ]

Class: Structures_Form_GroupInterface

Source Location: /Structures_Form-0.8.0devel/Form/GroupInterface.php

Class Overview


An interface to enforce consistency among all group elements used in a Structures_Form.


Author(s):

  • Scott Mattocks

Version:

  • 0.8.0devel

Copyright:

  • Copyright 2006 Scott Mattocks

Methods


Inherited Variables

Inherited Methods


Class Details

[line 39]
An interface to enforce consistency among all group elements used in a Structures_Form.

In HTML_QuickForm, all form elements extend a common base class. In PHP-GTK 2 this is not possible because the elements need to be added to containes. To be added to a container a class must extends GtkWidget. While it is not possible to force all form elements to inherit from the same base class we can use an interface to enforce some consistency.

A group is a way to logically and visually group elements together. It must be able to add, remove, reorder and return the elements in the group. It must also be able to return the value for one or all of elements in the group. When passed an array of values, the group object should set the value for each element in the array.

Groups must also implement the Structures_Form_ElementInterface.

NOTE: This interface provides new meanings for some of the methods defined by Structures_Form_ElementInterface. Make sure that any group that implements this interface, implements the correct definition of the method! The methods are given new meanings but not new names to make it easier for Structures_Form to get and set values.

A note contributors: I welcome contributions from others but I will not include any classes in the package that are not accompanied by a complete set of PHPUnit2 unit tests. Also, I am a stickler for documentation. Please make sure that your contributions are fully documented. Docblocks are not enough. There must be inline documentation. Please see Structures/Form.php for an example of what I mean by fully documented.

  • Author: Scott Mattocks
  • Version: 0.8.0devel
  • Copyright: Copyright 2006 Scott Mattocks
  • License: PHP


[ Top ]


Method Detail

addElement   [line 80]

boolean addElement( object $element)

Adds an element to the group.
  • Return: true if the element was added.
  • Access: public

Parameters:

object   $element   —  An element object.

[ Top ]

elementExists   [line 71]

boolean elementExists( string $name)

Returns whether or not an element with the given name exists in the group.
  • Return: true if the element is a member of the group.
  • Access: public

Parameters:

string   $name   —  The name of the element.

[ Top ]

getAllElements   [line 61]

array getAllElements( )

Returns an array containing all elements in the group.

The array should be of the form: array(<name> => <element>)

  • Access: public

[ Top ]

getElement   [line 51]

object The getElement( string $name)

Returns an element from a group.

This method should return the element with the given name. If there is no element with the given name, this method should return false.

  • Return: element object.
  • Access: public

Parameters:

string   $name   —  The element name.

[ Top ]

removeElement   [line 92]

void removeElement( object $element)

Removes an element from the group.

This method should fail gracefully (no errors or notices) if the element is not part of the group.

  • Access: public

Parameters:

object   $element   —  The element object to remove.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:44:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.