• Resolved ranone

    (@ranone)


    Hi,
    I’m looking for a way to get the “value title” (ex. for the select field) and the “title” (ex. for the field) from the name/placeholder of the field in the function.php file.

    I get the record object by Participants_Db::get_participant($record_id) function…

    A code example:

    
    $msg = '<ul>';
    foreach ($record as $name => $value) {
      if ( isset($value) && !empty($value) ) {
        $msg .= "<li>{ XXX }: { YYY }</li>";
      }
    }
    $msg = '</ul>';
    

    where:
    – XXX = field title
    – YYY = form element value title/value

    Is there a way to get the titles?

    I saw this page but in function.php not work:
    https://xnau.com/work/wordpress-plugins/participants-database/participants-database-documentation/template-tags/

    Thanks you so much for your time

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author xnau webdesign

    (@xnau)

    To get the value title, you need to use a field definition object so you can access the field’s settings. For example:

    $field = new PDb_Form_Field_Def( $name );
    $value_title = $field->value_title( $value );
    $field_title = $field->title();

    That will go inside your loop so you have access to the setting for the current field as it loops through.

    Thread Starter ranone

    (@ranone)

    Simply fantastic!!

    • This reply was modified 2 years, 12 months ago by ranone.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getter for form element title/value title’ is closed to new replies.