We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42802
    • 96 Posts
    Sebastian Zahn | ingroove.uy Reply #1, 11 years, 8 months ago
    Hi there!
    I´m using property sets for create getResources and getPage calls, they are great, but i can´t see a way to delete a property from a property set... Right click only shows "update".

    Thanks!

    Sebastián.

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

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Those are the default properties. You can only delete properties you have created.
        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
        • 42802
        • 96 Posts
        Sebastian Zahn | ingroove.uy Reply #3, 11 years, 8 months ago
        Thanks for your reply Susan!

        I attach a screenshot to reference.

        The properties listed on the right are properties i created ( to overwrite the default ones ).
        I want to duplicate the property sets so i can work faster, but sometimes i need to delete some properties. As i said, i can´t do it. You mean that if i create a property that already is a snippet property, then i can´t delete it?



        • discuss.answer
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No, those are not new properties that you have created. These are the default properties for the snippet, and their values can be modified but the properties cannot be deleted.
            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
            • 42802
            • 96 Posts
            Sebastian Zahn | ingroove.uy Reply #5, 11 years, 8 months ago
            Understood, thank you Susan!


            Quote from: sottwell at Jan 20, 2015, 09:40 AM
            No, those are not new properties that you have created. These are the default properties for the snippet, and their values can be modified but the properties cannot be deleted.
              • 42802
              • 96 Posts
              Sebastian Zahn | ingroove.uy Reply #6, 11 years, 7 months ago
              Fixed in Modx 2.3.3 smiley
              Added option to delete property from Property Set using the UI
                • 42562
                • 1,145 Posts
                Very good, is there a bulk delete for default property set?
                I duplicated a plugin, and started working extensively on it, with many events I don't wish to redo, and then went to the properties, only to see a bunch of inapplicable rubbish carried over during the duplicate.
                I could just create a new plugin, but what the heck with the travail if there could possibly be a way to delete (100+) properties automatcially.
                  TinymceWrapper: Complete back/frontend content solution.
                  Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                  5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                  • 42562
                  • 1,145 Posts
                  Okay I just realized I could do that with SQL.
                    TinymceWrapper: Complete back/frontend content solution.
                    Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                    5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                    • 3749
                    • 24,544 Posts
                    I think this would also do it:

                    $snippet = $modx->getObject('modSnippet', array('name' => 'SnippetName'));
                    $snippet->set('properties', null);
                    $snippet->save();
                    

                    If that doesn't work, this should:

                    $snippet = $modx->getObject('modSnippet', array('name' => 'SnippetName'));
                    $snippet->set('properties', array());
                    $snippet->save();
                    

                      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
                      • 42562
                      • 1,145 Posts
                      Okay, thanks, that works perfectly ( modified for my plugin).

                      I tried to re-engineer it to create a property set populated with values and whatnot, what a disaster!

                      Something like
                      $snippet = $modx->getObject('modPlugin', array('name' => 'myPlugin'));
                      $plugProperties = array(
                                  'name' => 'My Setting One',
                                  'description' => 'Description for setting one',
                                  'type' => 'textfield',
                                  'value' => 'value1',
                                  'area' => 'area1'
                      );
                      $snippet->set('properties', $plugProperties);
                      $snippet->save();

                      I am just too lazy not to allow my slave computer do the task. And the json in the Database is pure gibberish, else I would have gone that route.
                      Any help would be most appreciated.
                        TinymceWrapper: Complete back/frontend content solution.
                        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.