MEOW_FieldSetCollection

Represents the collection of field set item records in a MasterPress multiple-item field set.

Note: technically, for convenience, a single item field set is also modelled as a MEOW_FieldSetCollection, and not a MEOW_FieldSet. While this is slightly counterintuitive, it behaves the same way for all intents and purposes, as all access to fields underneath will always be on the first item in the collection (see example).

Example: Obtaining a MEOW_FieldSetCollection

List of Methods

Magic Methods

  • __call()

    An implementation of PHP 5’s __call magic method, which in this case simply silences the call by returning a WOOF_Silent instance.Note: this method is not intended to be called directly.

  • __get()MEOW_Field

    An implementation of PHP 5’s __get magic method, which in this case simply tries to access a field with the name provided via the field method.

  • __set( String $name, Mixed $value )

    An implementation of PHP 5’s __set magic method, to allow unknown properties to be set directly.

Properties

  • blank()Boolean

    Returns true if there is no data at all inside this field set collection.

  • count()Integer

    Returns the count of items in this field set collection.

  • create( Array $values = array(), Boolean $update = false )MEOW_FieldSet

    Returns a MEOW_FieldSet object to allow creation of a new item in this field set collection.

  • group_by( String $name )Array

    Returns an associative array of virtual field set collections grouped by the value in the given name.

  • psort( String $field, String $property, String $order = ASC )MEOW_VirtualFieldSetCollection

    Sorts the field set collection by the value of the specified field property.

  • range( Integer $from, Integer $to = null )MEOW_VirtualFieldSetCollection

    Returns a virtual field set collection representing a slice of the field set items in the collection starting at the from index supplied, and ending at the to index supplied. Important: in order to match up with the numbers presented in the user interface, this method is one-based.

Manipulation

  • __set( String $name, Mixed $value )

    An implementation of PHP 5’s __set magic method, to allow unknown properties to be set directly.

  • insert( Array $values = array() )MEOW_FieldSet

    A synonym for the MEOW_FieldSetCollection::create method, for creating a new field set in this collection, with the default value of the update parameter set to true.

  • remove( Integer $index )

    Removes the field set item at the given index from this collection.

  • update()

    Updates the database with with any changes made by any methods that can update the field set collection or the field sets / field within.

Theming

  • exists()Boolean

    Checks to see if this field set collection actually exists for the WordPress object it is requested on.

  • f( String $name )MEOW_Field

    A shorthand synonym of the field method, to retrieve the field of the given name in the first field set in the collection – for single item field sets, this is simply the field in the (only) field set, but for multiple items you may want to iterate over all of the field sets in the collection instead.

  • field( String $name )MEOW_Field

    Retrieve the field of the given name in the first field set in the collection – for single item field sets, this is simply the field in the (only) field set, but for multiple items you may want to iterate over all of the field sets in the collection instead.

  • filter( Array / String $args, Boolean $case_sensitive = false )MEOW_VirtualFieldSetCollection of MEOW_FieldSet

    Filters the field set collection according to rules that are passed in as the first argument.

  • has( String $name )MEOW_Field OR Boolean

    Checks to see if this field set collection has a field by the given name, but also if that field has a value available, returning the field itself if it is available, or boolean false otherwise.

  • insert( Array $values = array() )MEOW_FieldSet

    A synonym for the MEOW_FieldSetCollection::create method, for creating a new field set in this collection, with the default value of the update parameter set to true.

  • is( String $name )Boolean

    Returns true if the field by the given name returns true for its “is” method.

  • sort( String $field, String $order = ASC )MEOW_VirtualFieldSetCollection

    Returns a collection of field set items sorted by the values in the given field name.

  • sort_to( String $field, Array $values, String $order = ASC )MEOW_VirtualFieldSetCollection of MEOW_FieldSet

    Returns a field set collection of items sorted by the given field in the order of a supplied values map.

PHP Interface Method

Internal Use

  • __call()

    An implementation of PHP 5’s __call magic method, which in this case simply silences the call by returning a WOOF_Silent instance.Note: this method is not intended to be called directly.

  • __get()MEOW_Field

    An implementation of PHP 5’s __get magic method, which in this case simply tries to access a field with the name provided via the field method.

  • __set( String $name, Mixed $value )

    An implementation of PHP 5’s __set magic method, to allow unknown properties to be set directly.

  • info()MPM_FieldSet

    Returns the model object representing the definition of this field set in MasterPress.

  • mark_dirty()

    An internal method to mark this field set as dirty (modified).

  • rewind()

    Implements the rewind method required by PHP’s Iterator interface.

  • valid()Boolean

    Implements the valid method required by PHP’s Iterator interface.

  • versions()Array

    Returns the database rows for the stored versions of the content in this field set.

  • __call()

    An implementation of PHP 5’s __call magic method, which in this case simply silences the call by returning a WOOF_Silent instance.Note: this method is not intended to be called directly.

  • __get()MEOW_Field

    An implementation of PHP 5’s __get magic method, which in this case simply tries to access a field with the name provided via the field method.

  • __set( String $name, Mixed $value )

    An implementation of PHP 5’s __set magic method, to allow unknown properties to be set directly.

  • blank()Boolean

    Returns true if there is no data at all inside this field set collection.

  • count()Integer

    Returns the count of items in this field set collection.

  • create( Array $values = array(), Boolean $update = false )MEOW_FieldSet

    Returns a MEOW_FieldSet object to allow creation of a new item in this field set collection.

  • exists()Boolean

    Checks to see if this field set collection actually exists for the WordPress object it is requested on.

  • f( String $name )MEOW_Field

    A shorthand synonym of the field method, to retrieve the field of the given name in the first field set in the collection – for single item field sets, this is simply the field in the (only) field set, but for multiple items you may want to iterate over all of the field sets in the collection instead.

  • field( String $name )MEOW_Field

    Retrieve the field of the given name in the first field set in the collection – for single item field sets, this is simply the field in the (only) field set, but for multiple items you may want to iterate over all of the field sets in the collection instead.

  • filter( Array / String $args, Boolean $case_sensitive = false )MEOW_VirtualFieldSetCollection of MEOW_FieldSet

    Filters the field set collection according to rules that are passed in as the first argument.

  • group_by( String $name )Array

    Returns an associative array of virtual field set collections grouped by the value in the given name.

  • has( String $name )MEOW_Field OR Boolean

    Checks to see if this field set collection has a field by the given name, but also if that field has a value available, returning the field itself if it is available, or boolean false otherwise.

  • info()MPM_FieldSet

    Returns the model object representing the definition of this field set in MasterPress.

  • insert( Array $values = array() )MEOW_FieldSet

    A synonym for the MEOW_FieldSetCollection::create method, for creating a new field set in this collection, with the default value of the update parameter set to true.

  • is( String $name )Boolean

    Returns true if the field by the given name returns true for its “is” method.

  • mark_dirty()

    An internal method to mark this field set as dirty (modified).

  • psort( String $field, String $property, String $order = ASC )MEOW_VirtualFieldSetCollection

    Sorts the field set collection by the value of the specified field property.

  • range( Integer $from, Integer $to = null )MEOW_VirtualFieldSetCollection

    Returns a virtual field set collection representing a slice of the field set items in the collection starting at the from index supplied, and ending at the to index supplied. Important: in order to match up with the numbers presented in the user interface, this method is one-based.

  • remove( Integer $index )

    Removes the field set item at the given index from this collection.

  • rewind()

    Implements the rewind method required by PHP’s Iterator interface.

  • sort( String $field, String $order = ASC )MEOW_VirtualFieldSetCollection

    Returns a collection of field set items sorted by the values in the given field name.

  • sort_to( String $field, Array $values, String $order = ASC )MEOW_VirtualFieldSetCollection of MEOW_FieldSet

    Returns a field set collection of items sorted by the given field in the order of a supplied values map.

  • update()

    Updates the database with with any changes made by any methods that can update the field set collection or the field sets / field within.

  • valid()Boolean

    Implements the valid method required by PHP’s Iterator interface.

  • versions()Array

    Returns the database rows for the stored versions of the content in this field set.

Base Class Methods

View method list from the base class WOOF_Collection.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6.We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough with… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM