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

Wrong url and content format inside CMS-Module-Block #35

Closed
boehsermoe opened this issue Feb 3, 2018 · 4 comments
Closed

Wrong url and content format inside CMS-Module-Block #35

boehsermoe opened this issue Feb 3, 2018 · 4 comments
Labels

Comments

@boehsermoe
Copy link
Member

  1. Problem
    Inside a module thats included via cms-block the Url::to function will generate by the cms-page names (pretty url). But only when I pass an array as route it will be correctly, with a string it will generate the "raw" url (not pretty url).

  2. Problem
    I include the yii CaptchaWidget inside a cms-module-block and the CaptchaAction inside a controller of this module. The CaptchaAction-Url will generate correctly because the CaptchaWidget add the "v" parameter and pass the route as array. When I call the CaptchaAction-Url I will get an empty image. The result of NavItemModule::getContent will not return direct to the output.

    // it is a json response (so the Response object is set to JSON_FORMAT).
    if (is_array($content)) {
    return $content;
    }
    an array will be handled as JSON, maybe there should be inspect theYii::$app->response->format == Response::FORMAT_RAW and the other formats.

@boehsermoe boehsermoe changed the title Wrong Url and Layout inside CMS-Module-Block Wrong url and content format inside CMS-Module-Block Feb 3, 2018
@nadar
Copy link
Member

nadar commented Feb 4, 2018

hi @boehsermoe , first of thanks for taking time to help us improve LUYA!

  1. If i understand right, its a problem with the relativ url creating? We know this (Module route relative paths luya#1730) and maybe we could override Yii::$app->controller with the loaded module controller. i have to try this, not sure if it will break sth else.

  2. So the captcha action set's Response::FORMAT_RAW - So if understand right, you suggest we should check is_array && format == FORMAT:JSON? Or what would you suggest?

@nadar nadar added the bug label Feb 4, 2018
@boehsermoe
Copy link
Member Author

Additional to theis_array && format == FORMAT::JSON check the format == FORMAT::RAW and return the $content directly without any layout.

@nadar
Copy link
Member

nadar commented Feb 6, 2018

@boehsermoe i just pushed a fix.

I am not sure if we have to check for the array type and response as well.

Please let me know if this fix your problem. You can install the dev-master by using the^1.0@dev constraint.

@boehsermoe
Copy link
Member Author

Your fix works, thank you!

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

No branches or pull requests

2 participants