WP Residence Help WP Residence Help

  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API
Home / WPResidence / WPEstate CRM / WPResidence CRM Field Renderer — Developer Reference

WPResidence CRM Field Renderer — Developer Reference

51 views 0

Developer documentation for the field renderer of the WPResidence real estate CRM. Lives in libs/field-renderer.php and libs/metaboxes.php.

Field Type Registry

Supported types:

  • input — short text
  • textarea — long text
  • picklist — dropdown from a settings key
  • date — formatted via get_option('date_format')
  • number — locale-formatted via number_format_i18n()
  • taxonomy — references a taxonomy term by ID, displays the term name
  • post_type — references another post by ID, displays title + link
  • content — read-only HTML (legacy lead message display)

Field Registries

Each CPT/entity defines its fields as an array:

  • wpestate_return_contact_post_array() — 31+ contact fields.
  • wpestate_leads_post_array() — 6 lead fields.

Field Definition Shape

[
  'type'      => 'input' | 'textarea' | 'picklist' | ...,
  'label'     => 'Human label',
  'db_col'    => 'database_column',
  'section'   => 'personal_info' | 'contact_info' | ...,
  'source'    => 'settings_picklist_key' | taxonomy slug | post type slug,  // optional
  'required'  => true | false,
  'length'    => 'full',  // optional — 100% width on the form grid
  'placeholder' => '...',
  'editable'  => true | false,
]

Contact Form Sections

Section keys: personal_info, contact_info, address, social_profiles, lead_info, buyer_preferences, notes.

The form template loops the registry grouped by section, rendering section headers and fields in order.

Renderers

Function Mode
wpestate_crm_show_details() Editable — renders inputs
wpestate_crm_show_details_readonly() Read-only — renders formatted display HTML

Editable Field Helpers (libs/metaboxes.php)

  • wpestate_crm_return_input_metabox()
  • wpestate_crm_return_textarea_metabox()
  • wpestate_crm_return_picklist_metabox()
  • wpestate_crm_return_post_type_items() — select dropdown populated from a post type query (e.g., estate_agent).
  • wpestate_crm_return_taxonomy_metabox()

Read-Only Formatting

  • Empty values: rendered as the setting crm_empty_value_text (default —).
  • Numbers: number_format_i18n().
  • Dates: date_i18n(get_option('date_format'), $timestamp).
  • Taxonomy: get_term() and display the term name.
  • Post type: get_the_title() + get_permalink() hyperlink.

Picklist Source Resolution

For a field with type=picklist, source='crm_lead_sources', the renderer calls wpestate_crm_get_setting('crm_lead_sources') and splits on comma. Add options by adding values to the settings string — no code change required.

Adding a Brand-New Field

  1. Add the column to the table schema in libs/db-setup.php via dbDelta-compatible SQL (or add it from a child plugin’s own activation routine).
  2. Bump wpestate_crm_db_version so the activation routine re-runs dbDelta.
  3. Add the field definition to the appropriate registry array (wpestate_return_contact_post_array() or equivalent) — ideally fork via a filter hook in a child plugin rather than editing the CRM plugin.
  4. If the field needs a new picklist, add a default seed value in libs/settings.php.

Extending Without Editing the Plugin

The registries are plain function calls, so override is awkward. Pragmatic options:

  • Store extended data as JSON in an existing _meta longtext column rather than adding real columns — avoids schema changes.
  • Render extra fields on the detail page via a theme template override that wraps the CRM template.
  • If you must change the registry, fork the specific function in a wpestate-crm-extensions plugin that loads before the main CRM.

Non-Latin Input

All text-type inputs go through sanitize_text_field() or sanitize_textarea_field(), both UTF-8 safe. Picklist values are also stored as plain text and display any script correctly.

WPResidence / WPEstate CRM

Related Articles

  • WPResidence CRM Security Model — Developer Reference
  • CRM Security and Data Privacy
  • WPResidence CRM Installation and Updates — Developer Reference
  • Installing and Updating the WPResidence CRM

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 38Elementor Shortcodes Built-In
  • 45FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 23Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language Third Party Plugins
  • 6Other Third party Plugins
  • 19Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 36Property Pages & Layouts
  • 31Search & Filtering
  • 162Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 86Theme Options & Global Settings
  • 6Translations & Languages
  • 16WPBakery Shortcodes
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 8WPResidence Elementor Studio
  • 50WPResidence Translate Plugin

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API