1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then 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

Discussion in 'Showcase Closed Suggestions' started by conrad, Aug 17, 2013.

  1. conrad

    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
     
    Bob likes this.
  2. Daniel 'RTRD'

    Daniel 'RTRD' Member Showcase

    +1
     
  3. Bob

    Bob Developer Staff Member

    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}}}
     
    BT012SS likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.