How to access blueprint fields of multiselect options

Hi,

I am working on a website for a research lab, there is a members page as well as separate project pages. For each member i’ve included an multiselect option so they can include the projects they are part of. I am able to correctly display and link to the projects but am having trouble accessing the fields of the corresponding project. Ideally, i would like to access the title field so i can display the english and french translation with their appropriate title case styling.

The way i have it now, i use the Str::label() to get the project name and then add css styling to capitalize, this works well in the english version of the website but not for the French where title casing is used differently.

This is my code block taken from the members template:

<?php if ($member->projects()->isNotEmpty()): ?>
  <div class="member--projects">

    <?php foreach ($member->projects()->split() as $project): ?>
      <a href="projects/<?= $project ?>">
        
        <?php $projectPretty = Str::label($project); ?>
        <?= $projectPretty ?>
        
      </a>
    <?php endforeach; ?>
  </div>
<?php endif ?>

Thank you in advance for the help!
shabana

The first step would be to get the $project page object from the string in the multiselect (by the way, using a pages field would probably be the better option). And it looks as if you were storing only the page slug instead of the full path to the page in your multiselect, which makes this more difficult than needed.

   <?php foreach ($member->projects()as $projectName): ?>
      <?php $project = page('projects')->find($projectName); ?>
      <?php if ($project): ?>
      <a href="<?= $project->url() ?>>
        
        <?= $project->title() ?>
        
      </a>
    <?php endif ?>
    <?php endforeach; ?>