We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • So I have a option at install in my theme called add_content:

    addcontent.resolver.php
    <?php
    $sources = array(
        'data' => $modx->getOption('core_path') . 'components/solo/contentResources/',
    );
    
    $addContent = $modx->getOption('add_content', $options, false);
    if ($addContent) {
      $resources = include $sources['data'] . 'transport.resources.php';
      foreach ($resources as $resource) {
        $resource->save();
      }
    }
    
    $modx->addPackage('clientconfig', MODX_CORE_PATH . 'components/clientconfig/model/');
    
    $soloColorSettings = $modx->getObject('cgGroup', array('label' => 'Colors'));
    if (!$soloColorSettings) { 
      $soloColorSettings = $modx->newObject('cgGroup');
      $soloColorSettings->fromArray(array(
        'label' => 'Colors',
        'sortorder' => '1',
        'description' => 'Choose the colors for the site.'
      ));
      $soloColorSettings->save();
    }
    
    $accent_color = $modx->getObject('cgSetting', array('key' => 'solo.accent_color'));
    if (!$accent_color) { 
      $accent_color = $modx->newObject('cgSetting');
      $accent_color->fromArray(array(
        'key' => 'solo.accent_color',
        'label' => 'Accent color',
        'xtype' => 'colorpickerfield',
        'description' => 'The main accent color for the site.',
        'is_required' => '1',
        'sortorder' => '1',
        'value' => '448dcc',
        'group' => $soloColorSettings->get("id")
      ));
      $accent_color->save();
    }
    
    /* more setting here */
    
    $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;
    


    in build.transport.php I add the addcontent.resolver and remove the resource resolver:

    /* Package script resolvers, if any */
        if (($i == $count) && $hasResolvers) { /* add resolvers to last category only */
            $resolvers = empty($props['resolvers'])
                ? array()
                : $props['resolvers'];
            $resolvers = array_merge(array(
                      'category',
                      'plugin',
                      'tv',
                      'addcontent',
                      /* 'resource', */
                      'propertyset'
                 ), $resolvers);
            $helper->sendLog(modX::LOG_LEVEL_INFO,
                $modx->lexicon('mc_processing_resolvers'));
    


    To disable the content from being added at install is set in build.transport.php

    $hasResources = false;
    


    But I also need the resource.resolver.php to only run from my addcontent.resolver.php
    Or else the TV values get overwritten.

    addcontent.resolver.php
    <?php
    $sources = array(
        'data' => $modx->getOption('core_path') . 'components/solo/contentResources/',
    );
    
    $addContent = $modx->getOption('add_content', $options, false);
    if ($addContent) {
      $resources = include $sources['data'] . 'transport.resources.php';
      foreach ($resources as $resource) {
        $resource->save();
      }
    
    /* How do I run the resource.resolver.php here? */
    }
    
    return true;
    

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

    [ed. note: ThaClown last edited this post 8 years, 11 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
    • Ok I can't just put the full resolver code in my addcontent.resolver.php right?
      Does not seems to work.

      Can I include it somehow? [ed. note: ThaClown last edited this post 8 years, 11 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
      • I added the resource resolver in the addcontent resolver but it is not working.
        All is created and running except the resource.resolver
        Anybody know why?

        <?php
        $sources = array(
            'data' => $modx->getOption('core_path') . 'components/solo/contentResources/',
        );
        
        $addContent = $modx->getOption('add_content', $options, false);
        
        /* Add transport.resources if addContent is selected */
        
        if ($addContent) {
          $resources = include $sources['data'] . 'transport.resources.php';
          foreach ($resources as $resource) {
            $resource->save();
          }
        };
        
        /* Add resource.resolver if addContent is selected */
        
        if ($addContent) {
          if (!function_exists('checkFields')) {
            function checkFields($required, $objectFields) {
              global $modx;
              $fields = explode(',', $required);
              foreach ($fields as $field) {
                if (! isset($objectFields[$field])) {
                  $modx->log(modX::LOG_LEVEL_ERROR, '[Resource Resolver] Missing field: ' . $field);
                  return false;
                }
              }
              return true;
            }
          };
          if($object->xpdo) {
            $modx =& $object->xpdo;
            switch ($options[xPDOTransport::PACKAGE_ACTION]) {
              case xPDOTransport::ACTION_INSTALL:
              case xPDOTransport::ACTION_UPGRADE:
              $intersects = array (
                0 =>  array (
                  'pagetitle' => 'SOLO',
                  'parent' => '0',
                  'template' => 'SOLO homepage',
                  'tvValues' =>  array (
                    'solo.sections' => '[{"MIGX_id":"2","MIGX_formname":"3 Columns","fake":"","section_title":"Why use SOLO","section_subtitle":"Find out why this theme is great.","solo.section_bg_style":"bg_01","solo.3_col_col_1-title":"Created for MODX","solo.3_col_col_1-subtitle":"Powerfull CMS","solo.3_col_col_1-content":"Custom page options, the very best plugins and perfect themplate design are included in this MODX theme.","solo.3_col_col_1-icon_type":"font_icon","solo.3_col_col_1-icon_image":"","solo.3_col_col_1-icon_font":"fa-pencil","solo.3_col_col_2-title":"State of the art","solo.3_col_col_2-subtitle":"Modern code","solo.3_col_col_2-content":"SOLO theme is build using the latest and greatest web development techniques: HTML5, CSS3, jQuery, Gulp and Sass.","solo.3_col_col_2-icon_type":"font_icon","solo.3_col_col_2-icon_image":"","solo.3_col_col_2-icon_font":"fa-flask","solo.3_col_col_3-title":"Ready for any device","solo.3_col_col_3-subtitle":"Responsive grid","solo.3_col_col_3-content":"This theme will look and work great on any device. We use a Responsive grid to realize perfect design at any screen size.","solo.3_col_col_3-icon_type":"font_icon","solo.3_col_col_3-icon_image":"","solo.3_col_col_3-icon_font":"fa-mobile"},{"MIGX_id":"1","MIGX_formname":"2 Columns - image left","fake":"","section_title":"Features","section_subtitle":"Some of the main features of the Landing skin for MODX.","solo.section_bg_style":"bg_02","solo.2_col_img_left-col_1_img":"assets\\/components\\/solo\\/img\\/homepage\\/macbook_air.png","solo.2_col_img_left-col_1_img_alt":"Mackbook Air","solo.2_col_img_left-col_2_list_items":"[{\\"MIGX_id\\":\\"1\\",\\"title\\":\\"Easy to use & edit\\",\\"content\\":\\"Built for MODX, SOLO theme includes many custom page and site options that give you all the options you need. Dont know code or HTML? No problem! Everything can be edited using easy to use input field or WYSIWYG editors.\\",\\"icon_type\\":\\"font_icon\\",\\"icon_image\\":\\"\\",\\"icon_font\\":\\"fa-pencil\\"},{\\"MIGX_id\\":\\"2\\",\\"title\\":\\"Responsive & retina images\\",\\"content\\":\\"SOLO theme supports retina images and will create smaller versions of any image that you upload automatically. This keeps your website fast on smaller screens but also delevers the best quality to devices that supoport retina sized images.\\",\\"icon_type\\":\\"font_icon\\",\\"icon_image\\":\\"\\",\\"icon_font\\":\\"fa-picture-o\\"},{\\"MIGX_id\\":\\"3\\",\\"title\\":\\"Powerfull SEO options\\",\\"content\\":\\"Total controll over the SEO of every page. The theme includes a \\u2018How does this look in Google\\u2019 preview field and custom SEO fields. Also included: automatic Google sitemap, redirect options and keyword checks.\\",\\"icon_type\\":\\"font_icon\\",\\"icon_image\\":\\"\\",\\"icon_font\\":\\"fa-google\\"}]"},{"MIGX_id":"3","MIGX_formname":"Gallery","fake":"","section_title":"Gallery","section_subtitle":"Add, sort and maneage your images in a stylish way.","solo.section_bg_style":"bg_01","solo.gallery_section-gallery_items":"[{\\"MIGX_id\\":\\"1\\",\\"title\\":\\"Alarm\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/alarm.jpg\\"},{\\"MIGX_id\\":\\"2\\",\\"title\\":\\"Cave\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/bg_cave.jpg\\"},{\\"MIGX_id\\":\\"3\\",\\"title\\":\\"Mountains\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/bg_mountains.jpg\\"},{\\"MIGX_id\\":\\"4\\",\\"title\\":\\"Bridge\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/bridge.jpg\\"},{\\"MIGX_id\\":\\"5\\",\\"title\\":\\"Meeting room\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/meeting_room.jpg\\"},{\\"MIGX_id\\":\\"6\\",\\"title\\":\\"Water\\",\\"content\\":\\"A short description, image from unsplash.com.\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/gallery\\/water.jpg\\"}]"},{"MIGX_id":"4","MIGX_formname":"Team","fake":"","section_title":"Team","section_subtitle":"Introduce your team members in a nice slider.","solo.section_bg_style":"bg_01","solo.team_section-team_members":"[{\\"MIGX_id\\":\\"1\\",\\"name\\":\\"Jane Smith\\",\\"about\\":\\"Marketing\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/team\\/team_001.jpg\\",\\"social_links\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Twitter\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-twitter\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/twitter.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"title\\\\\\":\\\\\\"LinkedIn\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-linkedin\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/linkedin.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"3\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Facebook\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-facebook\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/facebook.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"4\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Google+\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-google-plus\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/googleplus.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"5\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Pinterest\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-pinterest\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/pinterest.com\\\\\\"}]\\"},{\\"MIGX_id\\":\\"2\\",\\"name\\":\\"David James\\",\\"about\\":\\"CTO\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/team\\/team_002.jpg\\",\\"social_links\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Facebook\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-facebook\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/facebook.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"title\\\\\\":\\\\\\"LinkedIn\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-linkedin\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/linkedin.com\\\\\\"}]\\"},{\\"MIGX_id\\":\\"3\\",\\"name\\":\\"Peter King\\",\\"about\\":\\"Lead Developer\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/team\\/team_003.jpg\\",\\"social_links\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Pinterest\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-pinterest\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/pinterest.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Twitter\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-twitter\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/twitter.com\\\\\\"}]\\"},{\\"MIGX_id\\":\\"4\\",\\"name\\":\\"Marcus Jones\\",\\"about\\":\\"Planning\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/team\\/team_004.jpg\\",\\"social_links\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Google+\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-google-plus\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/googleplus.com\\\\\\"}]\\"},{\\"MIGX_id\\":\\"5\\",\\"name\\":\\"Vincent Short\\",\\"about\\":\\"Lead Designer\\",\\"image\\":\\"assets\\/components\\/solo\\/img\\/team\\/team_005.jpg\\",\\"social_links\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Facebook\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-facebook\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/facebook.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"title\\\\\\":\\\\\\"LinkedIn\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-linkedin\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/linkedin.com\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"3\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Twitter\\\\\\",\\\\\\"social_type\\\\\\":\\\\\\"fa-twitter\\\\\\",\\\\\\"url\\\\\\":\\\\\\"http:\\/\\/twitter.com\\\\\\"}]\\"}]"},{"MIGX_id":"5","MIGX_formname":"Pricing","fake":"","section_title":"Pricing","section_subtitle":"Try for free or pick any of our mazing deals.","solo.section_bg_style":"bg_02","solo.pricing_pricing_tables":"[{\\"MIGX_id\\":\\"1\\",\\"title\\":\\"BASIC\\",\\"table\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"th\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Basic\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"256MB Memory\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"3\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"1 User\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"4\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"1 Website\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"5\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"1 Domain\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"6\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Unlimited Bandwidth\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"7\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"24\\/7 Support\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"8\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td_cta\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Order now\\\\\\",\\\\\\"url\\\\\\":\\\\\\"[[~1]]\\\\\\"}]\\"},{\\"MIGX_id\\":\\"2\\",\\"title\\":\\"POPULAR\\",\\"table\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"th\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Popular\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"512MB Memory\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"3\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"3 Users\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"4\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"5 Websites\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"5\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"7 Domains\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"6\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Unlimited Bandwidth\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"7\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"24\\/7 Support\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"8\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td_cta\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Order now\\\\\\",\\\\\\"url\\\\\\":\\\\\\"[[~1]]\\\\\\"}]\\"},{\\"MIGX_id\\":\\"3\\",\\"title\\":\\"PREMIER\\",\\"table\\":\\"[{\\\\\\"MIGX_id\\\\\\":\\\\\\"1\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"th\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Premier\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"2\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"1024MB Memory\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"3\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"5 Users\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"4\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"10 Websites\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"5\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"10 Domains\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"6\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Unlimited Bandwidth\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"7\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td\\\\\\",\\\\\\"title\\\\\\":\\\\\\"24\\/7 Support\\\\\\"},{\\\\\\"MIGX_id\\\\\\":\\\\\\"8\\\\\\",\\\\\\"row_type\\\\\\":\\\\\\"td_cta\\\\\\",\\\\\\"title\\\\\\":\\\\\\"Order now\\\\\\",\\\\\\"url\\\\\\":\\\\\\"[[~1]]\\\\\\"}]\\"}]"},{"MIGX_id":"6","MIGX_formname":"Contact","fake":"","section_title":"Contact","section_subtitle":"Got questions? Please get in touch!","solo.section_bg_style":"bg_01","contact_subject":"Contact request from the SOLO site","contact_email":"[email protected]","contact_thank_you_text":"Thank you for your message!","send_title":"SEND","solo.contact_form":"[{\\"MIGX_id\\":\\"1\\",\\"field_name\\":\\"Name\\",\\"icon\\":\\"fa-user\\",\\"type\\":\\"name\\",\\"mandatory\\":\\"required\\"},{\\"MIGX_id\\":\\"2\\",\\"field_name\\":\\"E-mail\\",\\"icon\\":\\"fa-envelope-o\\",\\"type\\":\\"email\\",\\"mandatory\\":\\"required\\"},{\\"MIGX_id\\":\\"5\\",\\"field_name\\":\\"Phone number\\",\\"icon\\":\\"fa-phone\\",\\"type\\":\\"phone\\",\\"mandatory\\":\\"\\"},{\\"MIGX_id\\":\\"4\\",\\"field_name\\":\\"Company\\",\\"icon\\":\\"fa-suitcase\\",\\"type\\":\\"company\\",\\"mandatory\\":\\"\\"},{\\"MIGX_id\\":\\"3\\",\\"field_name\\":\\"Message\\",\\"icon\\":\\"fa-pencil\\",\\"type\\":\\"message\\",\\"mandatory\\":\\"required\\"}]"}]',
                    'solo.stage_title' => 'creative / corporate / portfolio <br>one page theme',
                    'solo.stage_sub_title' => 'SOLO is a responsive, flexible and beautiful theme. Perfect to showcase your work & services in a stylish, modern way.',
                    'solo.stage_button_title' => 'OUR SERVICES',
                    'solo.stage_button_href' => '#section_1',
                  ),
                ),
                1 =>  array (
                  'pagetitle' => '404',
                  'parent' => '0',
                  'template' => 'SOLO basic page',
                ),
                2 =>  array (
                  'pagetitle' => 'Forbidden',
                  'parent' => '0',
                  'template' => 'SOLO basic page',
                ),
                3 =>  array (
                  'pagetitle' => 'Sitemap',
                  'parent' => '0',
                  'template' => 0,
                ),
              );
              if (is_array($intersects)) {
                foreach ($intersects as $k => $fields) {
                  /* make sure we have all fields */
                  if (! checkFields('pagetitle,parent,template', $fields)) {
                    continue;
                  }
                  $resource = $modx->getObject('modResource', array('pagetitle' => $fields['pagetitle']));
                  if (! $resource) {
                    continue;
                  }
                  if ($fields['template'] == 'default') {
                    $resource->set('template', $modx->getOption('default_template'));
                  } else {
                    $templateObj = $modx->getObject('modTemplate', array('templatename' => $fields['template']));
                    if ($templateObj) {
                      $resource->set('template', $templateObj->get('id'));
                    } else {
                      $modx->log(modX::LOG_LEVEL_ERROR, '[Resource Resolver] Could not find template: ' . $fields['template']);
                    }
                  }
                  if (!empty($fields['parent'])) {
                    if ($fields['parent'] != 'default') {
                      $parentObj = $modx->getObject('modResource', array('pagetitle' => $fields['parent']));
                      if ($parentObj) {
                        $resource->set('parent', $parentObj->get('id'));
                      } else {
                        $modx->log(modX::LOG_LEVEL_ERROR, '[Resource Resolver] Could not find parent: ' . $fields['parent']);
                      }
                    }
                  }
                  if (isset($fields['tvValues'])) {
                    foreach($fields['tvValues'] as $tvName => $value) {
                      $resource->setTVValue($tvName, $value);
                    }
                  }
                  $resource->save();
                }
              }
            }
          }
        };
        
        return true;
        
          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
          Lines 15,32,66, and 107 should not have a semicolon, though I'm not sure that's the problem.

          Try adding this line between lines 19 and 20 to see if the selected option is getting through:


          $modx->log(modX::LOG_LEVEL_ERROR, 'addContent is true');



          Another approach would be to use the original resource resolver, but add this near the top, but below the $modx =& $xPDO line:


          if  (!$modx->getOption('add_content', $options, false)) {
              return true;
          }

          [ed. note: BobRay last edited this post 8 years, 11 months ago.]
            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
          • That works Bob thanks so much.
              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
              My bad, that code should be:

              if  (!$modx->getOption('add_content', $options, false)) {
                  return true;
              }


              (fixed above)
                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
              • Just for those who want to see my code... Here what i use in my SOLO theme...
                  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