Jetengine repeater field get post content

Hi,

In jetengine option page I have create a repeater with 2 fields: a select where user can select a post from a list and a field text to add a custom text.

The select return the post id.

In frontend I would like to display the post title, post content and the text field from the repeater field related to the id selected with the select field.

In query loop settings i see the jetengine repeater field but how get the post title and content from the id?

Thanks.

Here my solution:

  1. In PHP query editor:
$originalArray = jet_engine()->listings->data->get_option( 'programmation::selection-musiciens-jour-1-fr' );
$musicienIds = [];
foreach ($originalArray as $item) {
  if (isset($item['musiciens'])) {
      $musicienIds[] = $item['musiciens']; 
  }
}
return [
  'post_type' => 'musiciens',
  'posts_per_page' => 2,
  'post__in' => $musicienIds,
  'orderby'        => 'post__in',
];
  1. I create a function to get the value of my custom text related to the post ID
function content_musiciens() {
    // Retrieve the data from the option set in JetEngine
    $originalArray = jet_engine()->listings->data->get_option( 'programmation::selection-musiciens-jour-1-fr' );

    // Get the current post ID
    $post_id = get_the_ID();

    // Iterate over each item in the array to find a match with $post_id
    foreach ($originalArray as $item) {
        if ($item['musiciens'] == $post_id) {
            // If a match is found, return the associated title
            return $item['titre'];
        }
    }

    // Return null if no match is found
    return null;
}

  1. i display my custom text with
{echo: content_musiciens}