Docs & Support

Learn about all Business Directory’s features and get support from our amazing customer success team.

Customizations
Form Fields API

Form Fields API

wpbdp_get_form_fields( $args )

This function can be used to obtain form fields from the database based on several criteria. The returned objects are instances of WPBDP_FormField.

Parameters

  • $args: (optional) Array or querystring of arguments used to query fields from the database. The valid options here are:
    • association: Field association. Valid choices are “title”, “category”, “tags” and “meta”.
    • validators: Field validators. Prepending “-“ to the validator name excludes fields with that validator.
    • display_flags: Field display flags. Prepending “-“ to the display flag excludes fields with that display flag set.
    • unique: If TRUE only the first field will be returned.

Return

An array of WPBDP_FormField instances or just one object if the argument unique is set to TRUE.
Fields are ordered by their position (weight) inside the table. See WPBDP_FormField for more details.

Examples

Retrieve all fields (regardless of their nature) and print their label:

<?php
	$fields = wpbdp_get_form_fields();
	
	foreach ( $fields as $field ) {
		print $field->get_label();
	}
?>

Retrieve the one field with “title” association:

<?php
	$title_field = wpbdp_get_form_fields('association=title&unique=1');
?>

Retrieve all required fields that don’t appear in the search form:

<?php
	$args = array( 'validators' => 'required', 'display_flags' => '-search' );
	$fields = wpbdp_get_form_fields( $args );
?>

wpbdp_get_form_field( $id )

This function obtains a field by its ID. For more complex field-related queries, use wpbdp_get_form_fields.

Parameters

  • $id: the field ID

Return

A WPBDP_FormField instance if the field is found or NULL if not.

Class Reference: WPBDP_FormField

Properties

Most of the WPBDP_FormField properties are private and should not be accessed directly. Use the getters & setters for this.

Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2010-2025 S11 Directories, LLC.

    Complete your purchase
    Special offer unlocked.
    Get $70 OFF!
    Complete Purchase
    Join 20,000+ using Business Directory Plugin to build website directories fast. Get Started