On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hello. I try to create a type TV (input), which loads the image. The problem is that in the derivation of TV output is only a relative path.

    Displayed: imagename.jpg
    Should so: /assets/images/imagename.jpg

    MediaSource displayed only type of image and file, it is necessary somehow to add my type myTypeImage. Specify it /core/model/modx/modtemplatevar.class.php, line 291

    public function prepareOutput($value, $resourceId= 0) {
            /* Allow custom source types to manipulate the output URL for image/file tvs */
            $mTypes = $this->xpdo->getOption('manipulatable_url_tv_output_types',null,'image,file');
            ...
    }


    I am trying to do so, but it did not work
    $this->xpdo->setOption('manipulatable_url_tv_output_types','image,file,myTypeImage');


    P.S. Sorry for my English
    • I found a solution, but I would like to hear the views of more experienced developers

      Plugin to an event "OnWebPageInit" and wrote the following code:
      case 'OnWebPageInit':
              $this->xpdo->setOption('manipulatable_url_tv_output_types', 'image,file,myTypeImage');
              break;


      Or
      case 'OnWebPageInit':
              $mTypes = $this->xpdo->getOption('manipulatable_url_tv_output_types',null,'image,file').',myTypeImage';
              $this->xpdo->setOption('manipulatable_url_tv_output_types', $mTypes);
              break;
      • That's looking good to me.
        I think, I would have it done exactly like that.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!