We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Strange issue, MyComponent install my theme fully, including sub-packages and optional content using a custom resolver:

    The resolver:

    <?php
    $sources = array(
        'data' => $modx->getOption('core_path') . 'components/cosmos/contentResources/',
    );
    
    $addContent = $modx->getOption('add_content', $options, false);
    if ($addContent) {
      $path = $sources['data'] . 'transport.resources.php';
      if (! file_exists($path) {
        $modx->log(modX::LOG_LEVEL_ERROR, 'File does not exist: ' . $path);
      }
      // Add content
      $resources = include $path;
      $ok = true;
      if (! is_array($resources)) {
        $modx->log(modX::LOG_LEVEL_ERROR, 'Resources not an array');
        $ok = false;
      } 
      if (empty($resources) ) {
        $modx->log(modX::LOG_LEVEL_ERROR, 'Resources is empty');
        $ok = false;
      }
      if ($ok) {
        foreach ($resources as $resource) {
          $resource->save();
        }
      }
    
      $modx->addPackage('clientconfig', MODX_CORE_PATH . 'components/clientconfig/model/');
    
      $analyticsSettings = $modx->getObject('cgGroup', array('label' => 'Google Analytics'));
      if (!$analyticsSettings) { 
        $analyticsSettings = $modx->newObject('cgGroup');
        $analyticsSettings->fromArray(array(
          'label' => 'Google Analytics',
          'sortorder' => '20',
          'description' => 'Settings for Google Analytics SEO'
        ));
        $analyticsSettings->save();
      }
    
    
      $analytics_code = $modx->getObject('cgSetting', array('key' => 'cosmos.analytics_code'));
      if (!$analytics_code) { 
        $analytics_code = $modx->newObject('cgSetting');
        $analytics_code->fromArray(array(
          'key' => 'cosmos.analytics_code',
          'label' => 'Analytics code',
          'xtype' => 'textfield',
          'description' => 'Fill in your tracking code (like: UA-10989210-17)',
          'is_required' => '0',
          'sortorder' => '1',
          'value' => '',
          'group' => $analyticsSettings->get("id")
        ));
        $analytics_code->save();
      }
    }
    
    $setSiteName = $modx->getOption('change_sitename', $options, false);
    if ($setSiteName) {
      $siteName = $modx->getOption('sitename', $options);
      $modx->log(xPDO::LOG_LEVEL_INFO,'Setting site name to: ' . $siteName);
      $setting = $modx->getObject('modSystemSetting','site_name');
      $setting->set('value', $siteName);
      $setting->save();
    }
    
    return true;
    


    When installing the first time, all sub-pages are placed in the site root, not under the correct resource.
    If I then re-install the theme the sub-pages are installed correctly.

    • For a parent resource, the isfolder setting is wrong, did MyComponent not set it?
    • For child resources, where is its parent set?



    The transport.resources.php file:

    <?php
    /**
     * resources transport file for cosmos extra
     *
     * Copyright 2014 by Menno Pietersen [email protected]
     * Created on 12-16-2014
     *
     * @package cosmos
     * @subpackage build
     */
    
    if (! function_exists('stripPhpTags')) {
        function stripPhpTags($filename) {
            $o = file_get_contents($filename);
            $o = str_replace('<' . '?' . 'php', '', $o);
            $o = str_replace('?>', '', $o);
            $o = trim($o);
            return $o;
        }
    }
    /* @var $modx modX */
    /* @var $sources array */
    /* @var xPDOObject[] $resources */
    
    
    $resources = array();
    
    $resources[1] = $modx->newObject('modResource');
    $resources[1]->fromArray(array (
      'id' => 1,
      'type' => 'document',
      'contentType' => 'text/html',
      'pagetitle' => 'Home',
      'longtitle' => '',
      'description' => '',
      'alias' => 'index',
      'link_attributes' => '',
      'published' => true,
      'isfolder' => false,
      'introtext' => '',
      'richtext' => true,
      'template' => 'Homepage',
      'menuindex' => 0,
      'searchable' => true,
      'cacheable' => true,
      'createdby' => 1,
      'editedby' => 2,
      'deleted' => false,
      'deletedon' => 0,
      'deletedby' => 0,
      'menutitle' => '',
      'donthit' => false,
      'privateweb' => false,
      'privatemgr' => false,
      'content_dispo' => 0,
      'hidemenu' => false,
      'class_key' => 'modDocument',
      'context_key' => 'web',
      'content_type' => 1,
      'hide_children_in_tree' => 0,
      'show_in_tree' => 1,
    ), '', true, true);
    $resources[1]->setContent(file_get_contents($sources['data'].'resources/home.content.html'));
    
    
    $properties = include $sources['data'].'properties/properties.home.resource.php';
    $resources[1]->setProperties($properties);
    unset($properties);
    
    $resources[2] = $modx->newObject('modResource');
    $resources[2]->fromArray(array (
      'id' => 2,
      'type' => 'document',
      'contentType' => 'text/html',
      'pagetitle' => 'Contact',
      'longtitle' => '',
      'description' => '',
      'alias' => 'contact',
      'link_attributes' => '',
      'published' => true,
      'isfolder' => false,
      'introtext' => 'Want to get in touch? please fill in the form below.',
      'richtext' => true,
      'template' => 'Contact page',
      'menuindex' => 4,
      'searchable' => true,
      'cacheable' => true,
      'createdby' => 2,
      'editedby' => 2,
      'deleted' => false,
      'deletedon' => 0,
      'deletedby' => 0,
      'menutitle' => '',
      'donthit' => false,
      'privateweb' => false,
      'privatemgr' => false,
      'content_dispo' => 0,
      'hidemenu' => false,
      'class_key' => 'modDocument',
      'context_key' => 'web',
      'content_type' => 1,
      'hide_children_in_tree' => 0,
      'show_in_tree' => 1,
    ), '', true, true);
    $resources[2]->setContent(file_get_contents($sources['data'].'resources/contact.content.html'));
    
    
    $properties = include $sources['data'].'properties/properties.contact.resource.php';
    $resources[2]->setProperties($properties);
    unset($properties);
    
    /* more resources */
    
    /* This is a parent resource, the isfolder setting is wrong, did MyComponent not set it? */
    
    $resources[9] = $modx->newObject('modResource');
    $resources[9]->fromArray(array (
      'id' => 9,
      'type' => 'document',
      'contentType' => 'text/html',
      'pagetitle' => 'Knowledge base',
      'longtitle' => '',
      'description' => '',
      'alias' => 'knowledge-base',
      'link_attributes' => 'rel="category"',
      'published' => true,
      'isfolder' => true,
      'introtext' => 'All FAQ\'s are listed below, enter keywords to filer the list.',
      'richtext' => true,
      'template' => 'Faq',
      'menuindex' => 1,
      'searchable' => true,
      'cacheable' => true,
      'createdby' => 2,
      'editedby' => 2,
      'deleted' => false,
      'deletedon' => 0,
      'deletedby' => 0,
      'menutitle' => '',
      'donthit' => false,
      'privateweb' => false,
      'privatemgr' => false,
      'content_dispo' => 0,
      'hidemenu' => false,
      'class_key' => 'modDocument',
      'context_key' => 'web',
      'content_type' => 1,
      'hide_children_in_tree' => 0,
      'show_in_tree' => 1,
    ), '', true, true);
    $resources[9]->setContent(file_get_contents($sources['data'].'resources/knowledge_base.content.html'));
    
    
    $properties = include $sources['data'].'properties/properties.knowledge_base.resource.php';
    $resources[9]->setProperties($properties);
    unset($properties);
    
    /* This is a child resource, where is its parent set? */
    
    $resources[10] = $modx->newObject('modResource');
    $resources[10]->fromArray(array (
      'id' => 10,
      'type' => 'document',
      'contentType' => 'text/html',
      'pagetitle' => 'How do I update your app?',
      'longtitle' => '',
      'description' => '',
      'alias' => 'how-do-i-update-your-app',
      'link_attributes' => '',
      'published' => true,
      'isfolder' => false,
      'introtext' => 'To update our app, just co to settings and click on update.',
      'richtext' => true,
      'template' => 'Awnser',
      'menuindex' => 0,
      'searchable' => true,
      'cacheable' => true,
      'createdby' => 2,
      'editedby' => 2,
      'deleted' => false,
      'deletedon' => 0,
      'deletedby' => 0,
      'menutitle' => '',
      'donthit' => false,
      'privateweb' => false,
      'privatemgr' => false,
      'content_dispo' => 0,
      'hidemenu' => false,
      'class_key' => 'modDocument',
      'context_key' => 'web',
      'content_type' => 1,
      'hide_children_in_tree' => 0,
      'show_in_tree' => 1,
    ), '', true, true);
    $resources[10]->setContent(file_get_contents($sources['data'].'resources/how_do_i_update_your_app_.content.html'));
    
    
    $properties = include $sources['data'].'properties/properties.how_do_i_update_your_app_.resource.php';
    $resources[10]->setProperties($properties);
    unset($properties);
    
    $resources[24] = $modx->newObject('modResource');
    $resources[24]->fromArray(array (
      'id' => 24,
      'type' => 'document',
      'contentType' => 'text/html',
      'pagetitle' => 'Support Theme is available on ThemesMODX',
      'longtitle' => '',
      'description' => '',
      'alias' => 'support-theme-is-available-on-themesmodx',
      'link_attributes' => '',
      'published' => true,
      'isfolder' => false,
      'introtext' => 'The latest version of this theme will be available on ThemesMODX.',
      'richtext' => true,
      'template' => 'News article',
      'menuindex' => 0,
      'searchable' => true,
      'cacheable' => true,
      'createdby' => 2,
      'editedby' => 2,
      'deleted' => false,
      'deletedon' => 0,
      'deletedby' => 0,
      'menutitle' => '',
      'donthit' => false,
      'privateweb' => false,
      'privatemgr' => false,
      'content_dispo' => 0,
      'hidemenu' => false,
      'class_key' => 'modDocument',
      'context_key' => 'web',
      'content_type' => 1,
      'hide_children_in_tree' => 0,
      'show_in_tree' => 1,
    ), '', true, true);
    $resources[24]->setContent(file_get_contents($sources['data'].'resources/support_theme_is_available_on_themesmodx.content.html'));
    
    /* more resources */
    
    $properties = include $sources['data'].'properties/properties.support_theme_is_available_on_themesmodx.resource.php';
    $resources[24]->setProperties($properties);
    unset($properties);
    
    return $resources;
    


    The transport resources part of the MyComponent config file:

    'exportResources' => array(
            'Home',
            'Contact',
            'Search results',
            '404',
            'Not allowed',
            'Site offline',
            'faq-json',
            'Sitemap'
        ),
        /* Array of resource parent IDs to get children of. */
        'parents' => array(
            'Knowledge base',
            'About',
            'News'
        ),
        /* Also export the listed parent resources
          (set to false to include just the children) */
        'includeParents' => true,
    


    Who can tell me what i can do to have the sub-pages installed correctly the first time?

    This question has been answered by BobRay. See the first response.

    [ed. note: ThaClown last edited this post 9 years, 5 months ago.]
      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
      DESIGNfromWITHIN, MPThemes and Any Screen Size
      Follow me on Twitter | Read my blog | My code on GitHub
    • Same issue if I use 'includeParents' => false

      'exportResources' => array(
              'Home',
              'Knowledge base',
              'About',
              'News',
              'Contact',
              'Search results',
              '404',
              'Not allowed',
              'Site offline',
              'faq-json',
              'Sitemap'
          ),
          /* Array of resource parent IDs to get children of. */
          'parents' => array(
              'Knowledge base',
              'About',
              'News'
          ),
          /* Also export the listed parent resources
            (set to false to include just the children) */
          'includeParents' => false,
      [ed. note: ThaClown last edited this post 9 years, 5 months ago.]
        MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
        DESIGNfromWITHIN, MPThemes and Any Screen Size
        Follow me on Twitter | Read my blog | My code on GitHub
        • 3749
        • 24,544 Posts
        I think I see what's happening. Some children are installed before their parents, so when it looks for the parent, it's not found -- but is found on the second install.

        The workaround would be to move the resources around in the transport.resources file so that a resource's parent is always above it. Let me know if that works. If so, I'll try to have MC order them.

        I could be wrong, but I think MODX now sets isFolder automatically based on whether the resource has children (as it was in Evo). As soon as they're saved, it will be correct, though it should also appear correctly in the fields in transport.resources if it is set correctly on the dev. site.

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
        • Thanks Bob,
          Unfortunately, that is not the case.
          The transport.resources.php is correct and all of the sub-resources are listed last...

          Still the problem on initial install stays.

          
          <?php
          /**
           * resources transport file for cosmos extra
           *
           * Copyright 2014 by Menno Pietersen [email protected]
           * Created on 12-16-2014
           *
           * @package cosmos
           * @subpackage build
           */
          
          if (! function_exists('stripPhpTags')) {
              function stripPhpTags($filename) {
                  $o = file_get_contents($filename);
                  $o = str_replace('<' . '?' . 'php', '', $o);
                  $o = str_replace('?>', '', $o);
                  $o = trim($o);
                  return $o;
              }
          }
          /* @var $modx modX */
          /* @var $sources array */
          /* @var xPDOObject[] $resources */
          
          
          $resources = array();
          
          $resources[1] = $modx->newObject('modResource');
          $resources[1]->fromArray(array (
            'id' => 1,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Home',
            'longtitle' => '',
            'description' => '',
            'alias' => 'index',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'Homepage',
            'menuindex' => 0,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 1,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[1]->setContent(file_get_contents($sources['data'].'resources/home.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.home.resource.php';
          $resources[1]->setProperties($properties);
          unset($properties);
          
          $resources[2] = $modx->newObject('modResource');
          $resources[2]->fromArray(array (
            'id' => 2,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Knowledge base',
            'longtitle' => '',
            'description' => '',
            'alias' => 'knowledge-base',
            'link_attributes' => 'rel="category"',
            'published' => true,
            'isfolder' => true,
            'introtext' => 'All FAQ\'s are listed below, enter keywords to filer the list.',
            'richtext' => true,
            'template' => 'Faq',
            'menuindex' => 1,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[2]->setContent(file_get_contents($sources['data'].'resources/knowledge_base.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.knowledge_base.resource.php';
          $resources[2]->setProperties($properties);
          unset($properties);
          
          $resources[3] = $modx->newObject('modResource');
          $resources[3]->fromArray(array (
            'id' => 3,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'About',
            'longtitle' => '',
            'description' => '',
            'alias' => 'about',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => true,
            'introtext' => 'This is some short text about our company.',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 2,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[3]->setContent(file_get_contents($sources['data'].'resources/about.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.about.resource.php';
          $resources[3]->setProperties($properties);
          unset($properties);
          
          $resources[4] = $modx->newObject('modResource');
          $resources[4]->fromArray(array (
            'id' => 4,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'News',
            'longtitle' => '',
            'description' => '',
            'alias' => 'news',
            'link_attributes' => 'rel="category"',
            'published' => true,
            'isfolder' => true,
            'introtext' => '',
            'richtext' => true,
            'template' => 'News container',
            'menuindex' => 3,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[4]->setContent(file_get_contents($sources['data'].'resources/news.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.news.resource.php';
          $resources[4]->setProperties($properties);
          unset($properties);
          
          $resources[5] = $modx->newObject('modResource');
          $resources[5]->fromArray(array (
            'id' => 5,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Contact',
            'longtitle' => '',
            'description' => '',
            'alias' => 'contact',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'Want to get in touch? please fill in the form below.',
            'richtext' => true,
            'template' => 'Contact page',
            'menuindex' => 4,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[5]->setContent(file_get_contents($sources['data'].'resources/contact.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.contact.resource.php';
          $resources[5]->setProperties($properties);
          unset($properties);
          
          $resources[6] = $modx->newObject('modResource');
          $resources[6]->fromArray(array (
            'id' => 6,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Search results',
            'longtitle' => '',
            'description' => '',
            'alias' => 'search-results',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'Search results',
            'menuindex' => 5,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[6]->setContent(file_get_contents($sources['data'].'resources/search_results.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.search_results.resource.php';
          $resources[6]->setProperties($properties);
          unset($properties);
          
          $resources[7] = $modx->newObject('modResource');
          $resources[7]->fromArray(array (
            'id' => 7,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => '404',
            'longtitle' => '',
            'description' => '',
            'alias' => '404',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 6,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[7]->setContent(file_get_contents($sources['data'].'resources/404.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.404.resource.php';
          $resources[7]->setProperties($properties);
          unset($properties);
          
          $resources[8] = $modx->newObject('modResource');
          $resources[8]->fromArray(array (
            'id' => 8,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Not allowed',
            'longtitle' => '',
            'description' => '',
            'alias' => 'not-allowed',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 7,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[8]->setContent(file_get_contents($sources['data'].'resources/not_allowed.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.not_allowed.resource.php';
          $resources[8]->setProperties($properties);
          unset($properties);
          
          $resources[9] = $modx->newObject('modResource');
          $resources[9]->fromArray(array (
            'id' => 9,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Site offline',
            'longtitle' => '',
            'description' => '',
            'alias' => 'site-offline',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 8,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[9]->setContent(file_get_contents($sources['data'].'resources/site_offline.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.site_offline.resource.php';
          $resources[9]->setProperties($properties);
          unset($properties);
          
          $resources[10] = $modx->newObject('modResource');
          $resources[10]->fromArray(array (
            'id' => 10,
            'type' => 'document',
            'contentType' => 'application/json',
            'pagetitle' => 'faq-json',
            'longtitle' => '',
            'description' => '',
            'alias' => 'faq-json',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => false,
            'template' => 'json all',
            'menuindex' => 9,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 7,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[10]->setContent(file_get_contents($sources['data'].'resources/faq-json.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.faq-json.resource.php';
          $resources[10]->setProperties($properties);
          unset($properties);
          
          $resources[11] = $modx->newObject('modResource');
          $resources[11]->fromArray(array (
            'id' => 11,
            'type' => 'document',
            'contentType' => 'text/xml',
            'pagetitle' => 'Sitemap',
            'longtitle' => '',
            'description' => '',
            'alias' => 'sitemap',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => false,
            'template' => 0,
            'menuindex' => 11,
            'searchable' => false,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => true,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 2,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[11]->setContent(file_get_contents($sources['data'].'resources/sitemap.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.sitemap.resource.php';
          $resources[11]->setProperties($properties);
          unset($properties);
          
          $resources[12] = $modx->newObject('modResource');
          $resources[12]->fromArray(array (
            'id' => 12,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'How do I update your app?',
            'longtitle' => '',
            'description' => '',
            'alias' => 'how-do-i-update-your-app',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'To update our app, just co to settings and click on update.',
            'richtext' => true,
            'template' => 'Awnser',
            'menuindex' => 0,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[12]->setContent(file_get_contents($sources['data'].'resources/how_do_i_update_your_app_.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.how_do_i_update_your_app_.resource.php';
          $resources[12]->setProperties($properties);
          unset($properties);
          
          $resources[13] = $modx->newObject('modResource');
          $resources[13]->fromArray(array (
            'id' => 13,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Where can I find documentation?',
            'longtitle' => '',
            'description' => '',
            'alias' => 'where-can-i-find-documentation',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'The documentation of our app can be found under settings > help.',
            'richtext' => true,
            'template' => 'Awnser',
            'menuindex' => 1,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[13]->setContent(file_get_contents($sources['data'].'resources/where_can_i_find_documentation_.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.where_can_i_find_documentation_.resource.php';
          $resources[13]->setProperties($properties);
          unset($properties);
          
          $resources[14] = $modx->newObject('modResource');
          $resources[14]->fromArray(array (
            'id' => 14,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Is the iPhone 6 supported?',
            'longtitle' => '',
            'description' => '',
            'alias' => 'is-the-iphone-6-supported',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'Yes! Our app has full iPhone 6 and iPhone 6 Plus support as well as support for Windows mobile and Anroid.',
            'richtext' => true,
            'template' => 'Awnser',
            'menuindex' => 2,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[14]->setContent(file_get_contents($sources['data'].'resources/is_the_iphone_6_supported_.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.is_the_iphone_6_supported_.resource.php';
          $resources[14]->setProperties($properties);
          unset($properties);
          
          /* Removed some to make it short */
          
          $resources[20] = $modx->newObject('modResource');
          $resources[20]->fromArray(array (
            'id' => 20,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Sub page',
            'longtitle' => '',
            'description' => '',
            'alias' => 'sub-page',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 0,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[20]->setContent(file_get_contents($sources['data'].'resources/sub_page.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.sub_page.resource.php';
          $resources[20]->setProperties($properties);
          unset($properties);
          
          $resources[21] = $modx->newObject('modResource');
          $resources[21]->fromArray(array (
            'id' => 21,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Another sub page',
            'longtitle' => '',
            'description' => '',
            'alias' => 'another-sub-page',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 1,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[21]->setContent(file_get_contents($sources['data'].'resources/another_sub_page.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.another_sub_page.resource.php';
          $resources[21]->setProperties($properties);
          unset($properties);
          
          $resources[22] = $modx->newObject('modResource');
          $resources[22]->fromArray(array (
            'id' => 22,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Shortcodes',
            'longtitle' => '',
            'description' => '',
            'alias' => 'shortcodes',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => '',
            'richtext' => true,
            'template' => 'General page',
            'menuindex' => 2,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[22]->setContent(file_get_contents($sources['data'].'resources/shortcodes.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.shortcodes.resource.php';
          $resources[22]->setProperties($properties);
          unset($properties);
          
          $resources[23] = $modx->newObject('modResource');
          $resources[23]->fromArray(array (
            'id' => 23,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Includes contact form and news section',
            'longtitle' => '',
            'description' => '',
            'alias' => 'includes-contact-form-and-news-section',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'Your Support theme website will include a great contact form with spam check and a powerful news section.',
            'richtext' => true,
            'template' => 'News article',
            'menuindex' => 1,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[23]->setContent(file_get_contents($sources['data'].'resources/includes_contact_form_and_news_section.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.includes_contact_form_and_news_section.resource.php';
          $resources[23]->setProperties($properties);
          unset($properties);
          
          $resources[24] = $modx->newObject('modResource');
          $resources[24]->fromArray(array (
            'id' => 24,
            'type' => 'document',
            'contentType' => 'text/html',
            'pagetitle' => 'Support Theme is available on ThemesMODX',
            'longtitle' => '',
            'description' => '',
            'alias' => 'support-theme-is-available-on-themesmodx',
            'link_attributes' => '',
            'published' => true,
            'isfolder' => false,
            'introtext' => 'The latest version of this theme will be available on ThemesMODX.',
            'richtext' => true,
            'template' => 'News article',
            'menuindex' => 0,
            'searchable' => true,
            'cacheable' => true,
            'createdby' => 2,
            'editedby' => 2,
            'deleted' => false,
            'deletedon' => 0,
            'deletedby' => 0,
            'menutitle' => '',
            'donthit' => false,
            'privateweb' => false,
            'privatemgr' => false,
            'content_dispo' => 0,
            'hidemenu' => false,
            'class_key' => 'modDocument',
            'context_key' => 'web',
            'content_type' => 1,
            'hide_children_in_tree' => 0,
            'show_in_tree' => 1,
          ), '', true, true);
          $resources[24]->setContent(file_get_contents($sources['data'].'resources/support_theme_is_available_on_themesmodx.content.html'));
          
          
          $properties = include $sources['data'].'properties/properties.support_theme_is_available_on_themesmodx.resource.php';
          $resources[24]->setProperties($properties);
          unset($properties);
          
          return $resources;
          
            MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
            DESIGNfromWITHIN, MPThemes and Any Screen Size
            Follow me on Twitter | Read my blog | My code on GitHub
            • 3749
            • 24,544 Posts
            Your resolver is not setting the parent field of each resource. How is it getting set?
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Haha you tell me I have no idea!
                MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
                DESIGNfromWITHIN, MPThemes and Any Screen Size
                Follow me on Twitter | Read my blog | My code on GitHub
              • discuss.answer
                • 3749
                • 24,544 Posts
                Here's my thinking. There must be a resource resolver based on your config file, but it's running before your custom resolver that adds the resources.

                You need to modify the build.transport.php file so that your custom resolver is added to the package before the resource resolver is added.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting