Magic Fields Functions

These are the all the functions defined in mf_front_end.php. Some of these may be auxiliary functions and not intended for use by the end user. Many of these should be self explanatory. I will further document these as I learn about them.

mixed get( $field_name, $group_index=1, $field_index=1, $post_id=NULL )
Returns the value of the field. The type is appropriate to the value of the field, e.g., sometimes a string, sometimes a number, sometimes an array (for Checkbox List and multi-valued Dropdown).
int get_count_field( $field_name , $group_index = 1 , $post_id = NULL )
Useful to check for the existence of a field and the number of occurrences of a duplicated field. Note that a Checkbox List or a multi-valued Dropdown is not stored as a duplicated field but as a single value which is an array.
int get_count_group( $field_name, $post_id = NULL )
$field_name is the name (slug) of a field in a group – it is not the name of the group. This returns the number of groups that contain $field_name.
function get_audio( $field_name, $group_index=1, $field_index=1 , $post_id=NULL )

function pt()
        This is an auxiliary function and returns the path to "phpThumb.php" - a thumbnail generator utility.
array function get_order_group( $field_name, $post_id = NULL )
$field_name is the name (slug) of a field in a group – it is not the name of the group. This apparently returns the array of indices for a duplicated group. This always seems to be 1 to get_count_group( $field_name, $post_id ). (These facts were empirically determined.)
array get_order_field( $field_name, $group_index = 1, $post_id = NULL )
This apparently returns the array of indices for a duplicated field. This always seems to be 1 to get_count_field( $field_name, $group_index, $post_id ). (These facts were empirically determined.)
string get_post_type_name( $post_id = NULL )
Returns the Magic Fields post type.
string get_image( $field_name, $group_index=1, $field_index=1, $tag_img=1, $post_id=NULL, $params=NULL, $attr = NULL, $wp_size=’original’)
Returns the html text for an image e.g., “<img src=”… />”. This uses phpThumb which uses the GD library to create images.
array get_field( $field_name, $group_index = 1, $post_id = NULL )
Returns the array of field values of all fields with name = $field_name in the group with group index = $group_index.
array get_group( $group_name, $post_id = NULL )
This returns an array of arrays. The members of the outer array corresponds to groups of type $group_name. The keys are numeric group indices. The members of inner array correspond to the fields of the group of type $group_name. The keys are field names and the values are field values. The fields of a post type that are not in a specified group are actually in a group named “__default” and can be accessed by the call get_group( “__default”, $post_id ).
string get_label( $field_name, $post_id=NULL )
Returns the label of the field.
function create_image( $options )
        This is an auxiliary function called by get_image().

function aux_image( $value,$params,$type = NULL )
        This is an auxiliary function.

function _processed_value( $value, $type, $options = array(), $image_array = 0 )
        This is an auxiliary function called by get_data(), get_field() and get_group().
array get_data( $field_name, $group_index, $field_index, $post_id )
Returns an array containing both the field value and the field attributes – id, type, description, label, and options.
function _resolve_linebreaks( $data = NULL )
        This function is apparently never called.

function _processed_params( $params = array() )
        This is an auxiliary function called by _processed_value().

How to report problems, ask questions, …

Please post your problem reports, questions, requests and comments to the Magic Fields 2 Toolkit support forum.

Advertisements