We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33969
    • 60 Posts
    I am writing a simple addon to add icons to different Google Maps. The maps are in a container called maps. This allows new maps to be added to the system. When you add an icon to a map, you get a ComboBox that lists all the maps so you can select which map to add the icon to.

    The code for the ComboBox just retrieves all the maps in the container. I want to be able to pass the id of the container to ComboBox code (right now it is hard coded).

    From looking at other add ons it looks like I can do this as a Parameter in the Action Menu with something like '&map_parent=2'.

    What I can't find is how do I retrieve the parameter code?

    This is the code in the Grid:

    MapOverlay.combo.MapTypes = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            url: MapOverlay.config.connectorUrl,
            baseParams: {
                action: 'mgr/combobox/maptypes',
                property: config.property,
                emptyOption: config.emptyOption || false
            },
            fields: ['id','pagetitle'],
            hiddenName: config.name || 'maptype',
            pageSize: 15,
            valueField: 'id',
            displayField: 'pagetitle'
        });
        MapOverlay.combo.MapTypes.superclass.constructor.call(this,config);
    };
    Ext.extend(MapOverlay.combo.MapTypes,MODx.combo.ComboBox);
    Ext.reg('map-combo-maptypes',MapOverlay.combo.MapTypes);


    And this is the code to generate the ComboBox called maptypes.php is:

    $maptypes = $modx->getCollection('modResource',array('parent'=>'2'));
     
    foreach ($maptypes as $obj) {
        $results[] = $obj->toArray('', false, true);
    }
     
    $returnArray = array(
        'success' => true,
        'results' => $results
    );
    return $modx->toJSON($returnArray);


    I am building it in Revolution 2.2.4 and have been using the new Doodles tutorial and Bob Ray's book as a guide. (Thanks Bob - the book is a great help)
      Michael Regan
      TIMR Web Services
      Phone: 250.218.5284
      Eamil: [email protected]
      Website: timr.ca
      • 33969
      • 60 Posts
      Solved

      I was looking in the wrong spot. I just needed to add the value into the System Settings.

      All the information is here http://rtfm.modx.com/display/revolution20/System+Settings
        Michael Regan
        TIMR Web Services
        Phone: 250.218.5284
        Eamil: [email protected]
        Website: timr.ca