We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    Hovering on a resource in the resource tree of the manager, a tooltip will show up.
    What is shown here is the value of the variable $qtip determined in lines 380-390 of the file
    \core\model\modx\processors\resource\getnodes.class.php
    If there is a value set in the System Settings (search for "tooltip"), it is taken from $qtipField:
            $qtip = '';
            if (!empty($qtipField)) {
                $qtip = '<b>'.strip_tags($resource->$qtipField).'</b>';
            } else {
                if ($resource->longtitle != '') {
                    $qtip = '<b>'.strip_tags($resource->longtitle).'</b><br />';
                }
                if ($resource->description != '') {
                    $qtip = '<i>'.strip_tags($resource->description).'</i>';
                }
            }
    

    I tried to set a fixed field for this tooltip (ignoring the System Setting).
    So I commented out lines 380-390 and put this in:
    $qtip = '<br /><b>menuindex = '. $resource->menuindex .'</b>';
    
    That worked as intended.

    But if I take
    $qtip = '<br /><b>template = '. $resource->template .'</b>';
    
    it wouldn't work: The returned value is always 0.

    What is the reason for this behaviour?
      • 3186 ☆ A M B ☆
      • 279 Posts
      As I can see in the getnodes processor, in method getResourceQuery() (line 149 <> MODX 2.2.6).. the "template" field isn't selected.
        MODX Ambassador (NL) & Professional MODX developer
        Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
        MODX e-commerce solution SimpleCart
        • 22303 MODX Staff
        • 10,725 Posts
        FWIW, if you use the get() method to access the template, MODX will issue an additional query to load the "lazy" field value from the database. Probably not optimal, but could allow you to do what you want if you don't have Resource nodes with a large number of children.
          • 22427
          • 793 Posts
          @bertoost
          I added the entry ,template to the array $resourceColumns, that solved my problem. Thank you!

          @opengeek
          Thank you too. Didn't try it (since the above worked for me). This solution would avoid loosing the modification in an future Upgrade of MODX.
          But why not add all the resource fields to the array $resourceColumns?
          Is there any point against it?
          I will put a feature request to the issue tracker.
            • 22303 MODX Staff
            • 10,725 Posts
            We do not include all the columns to reduce the amount of data sent per node. The larger the data set per node, the slower the tree nodes will respond/refresh. For instance, we would never want to include the content field in this data set.
              • 22427
              • 793 Posts
              Okay, I understand. So a System Setting would be nice, where you could choose which field (or, even better, fields) to show in the tooltip - excluding the content field of cource...
                • 22427
                • 793 Posts
                After a second thought: The amount of data sent per node depends on the field(s) assembled in the variable $qtip, but not on the size of the array $resourceColumns. So it should do no harm to extend this array to most of the resource fields (but content). [ed. note: ottogal last edited this post 13 years, 9 months ago.]
                  • 3186 ☆ A M B ☆
                  • 279 Posts
                  Quote from: ottogal at Dec 13, 2012, 05:33 PM
                  @bertoost
                  I added the entry ,template to the array $resourceColumns, that solved my problem. Thank you!

                  Glad it worked for you, but I suggest never to hack the core files, at upgrading you're busted ;-)
                    MODX Ambassador (NL) & Professional MODX developer
                    Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
                    MODX e-commerce solution SimpleCart
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: ottogal at Dec 13, 2012, 07:11 PM
                    After a second thought: The amount of data sent per node depends on the field(s) assembled in the variable $qtip, but not on the size of the array $resourceColumns. So it should do no harm to extend this array to most of the resource fields (but content).
                    That may be the data sent over the wire per node for the AJAX requests, but the additional data and memory being used server side and handled in the database connection is increased and does harm performance, though certainly not as much as if it were being sent back.

                    I suggest adding a feature request for this setting in the tracker.
                      • 22427
                      • 793 Posts
                      Ok, thanks a lot.