We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41592 ☆ A M B ☆
    • 83 Posts
    Hello everyone! I'm trying to make a new 3rd CMP and I want to import in Modx some "media Source" in my package.

    I've made a transport package and I've inserted snippets,chunks,resources,templates and a lot of other components.

    When I'm trying to import "Media Sources" I make a new object like this in my transport.mediasources.php:

    $swingMS['crociere_listview_img'] = $modx->newObject('sources.modMediaSource');
    $swingMS['crociere_listview_img']->fromArray(array(
                'name' => 'Crociere ListView Path',
                'description' => '',
                'class_key' => 'sources.modFileMediaSource',
    'properties'=>array(),
    ),'',true,true);
    
    return $swingMS;


    It'll imported but without properties (like basePath).

    I've tried to make a new array like:
    array('basePath' => 'mybasepath'); 


    but without result.

    How can I sets all my properties correctly?

    Thx!
      Francesco Mussoni | MODX Ambassador | Skype: solidusite2 | Email: [email protected]
      • 41592 ☆ A M B ☆
      • 83 Posts
      Excellent! I was able to import everything. I had to create an array of properties!

      $swingMS['crociere_listview_img'] = $modx->newObject('sources.modMediaSource');
      $swingMS['crociere_listview_img']->fromArray(array(
      			'id' => 4,
                  'name' => 'Crociere ListView Path',
                  'description' => '',
                  'class_key' => 'sources.modFileMediaSource'
              ),'',true,true);
      $swingMS['crociere_listview_img']->setProperties(array(
          array(
              'name' => 'basePath',
              'desc' => 'prop_swingtime.basePath',
              'type' => 'textfield',
              'options' => '',
              'value' => 'assets/components/swingtime/images/crociere_listview_img/',
              'lexicon' => 'swingtime:properties',
          )
      ));


      :)
        Francesco Mussoni | MODX Ambassador | Skype: solidusite2 | Email: [email protected]