• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Expose custom fields outside the item view

conrad

New Member
Showcase
Custom field data is currently only exposed in the item view.

I think it would be useful to also expose them via "Self Placement" in Category View, Member View and Index View.

Fields such as "price" or "location" could then show under each item on the landing page, etc.

Thanks
 
  • Like
Reactions: Bob
Upvote 1
Custom Field data for each item is now exposed where ever items are "prepared" (which is pretty much everywhere, lists, blocks, widgets etc). They are exposed as $item.customFields <--- an array, so to access a specific element, it would be $item.customFields[fieldId] where as fieldID is the unique ID of that field when you created it.

PHP:
  ["customFields"] => array(6) {
    ["_owntab1"] => string(14) "test test test"
    ["_owntab2"] => string(0) "some test text"
    ["_owntab3"] => string(0) "weeeeeeeee"
    ["_owntab4"] => string(0) "nom nom nom"
    ["selfplace1"] => string(6) "Pizza!"
    ["tab1_field2"] => array(2) {
      ["COLOR_1"] => string(7) "COLOR_1"
      ["COLOR_2"] => string(7) "COLOR_2"
    }
  }

Phrases are cached and now use Helpers, so to properly display COLOR_1

The first one is for the TITLE and the 2nd one is for the VALUE

HTML:
{xen:helper showcaseFieldTitle, $fieldId}

{xen:helper showcaseFieldValue, $item, $fieldId, {$item.customFields.{$fieldId}}}
 
Back
Top