We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    How do you access media source paths programatically? For example, you can get a TV value for a given resource, but how would you determine if that TV was assigned a media source, and what its path should be?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 34926
      • 87 Posts
      I just created a quick test snippet which might be along the right lines.

      <?php
      // Get the media source ID for the TV
      $tv = $modx->getObject('modTemplateVar', '4');
      $source = $tv->get('source');
      
      // Get media source properties
      $ms = $modx->getObject('modMediaSource', array('id' => $source));
      $properties = $ms->get('properties');
      
      echo '<pre>'; print_r($properties); die();
        • 22303 MODX Staff
        • 10,725 Posts
        You have to process the TV to get the full value.