Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the path for the photos in renderChunck #372

Open
Alexij2 opened this issue May 18, 2021 · 1 comment
Open

Add the path for the photos in renderChunck #372

Alexij2 opened this issue May 18, 2021 · 1 comment

Comments

@Alexij2
Copy link
Contributor

Alexij2 commented May 18, 2021

Hello!
I suggest adding the ability to correctly render photos via renderChunck. To do this, you need to set the placeholder of the path for the photo in this chunk field, taking into account the source from TV. I offer an example of a solution here. If what I suggest can be solved in a different way, great.

For example render chunk here
http://joxi.ru/p279MNzUKqQZgr


And the code for setting the tvsourcepath.

// add the path by the photos for renderChunck
        if($properties['_request']['tv_name']){
            $restv = $this->modx->getObject('modTemplateVar',['name' => $properties['_request']['tv_name']]);
            $sore = $restv->get('source');
            if ($sore != 0){
                $this->source = $this->modx->getObject('modMediaSource', $sore);
            }
        }
        if($this->source){
            $soura = $this->source->toArray();
            $pathimgs = trim($soura['properties']['basePath']['value']); // путь
            $mypars = $this->modx->getParser();
            $mypars->processElementTags('',$pathimgs,true, true, '[[', ']]', [], 5);
            unset($mypars);
            $pathimgs = '/'.$pathimgs;
            $properties['tvsourcepath'] = $pathimgs; // magic placeholder
        }

Past it in metod renderChunk от migx.class.php in line 1621 before parse.

@Bruno17
Copy link
Owner

Bruno17 commented May 18, 2021

that's not the right place to add this functionality.
renderChunk could be called from elsewhere.
So, all needed properties should be passed from outside into the renderChunk - method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants