When I disable
cms.middleware.multilingual.MultilingualURLMiddleware
I have
Caught an exception while rendering 'WSGIRequest' object has no attribute 'LANGUAGE_CODE'
when edit pages, or use {% show_menu_below_id %} tag.
I don't need lang prefix please, help me disable this stuff.
add 'django.middleware.locale.LocaleMiddleware' to MIDDLEWARE_CLASSES
issue:
http://github.com/divio/django-cms/issues/issue/424#issue/424/comment/188388
use "lang = get_language()" in menu pool
Related
I need to check if anchor URL added from the CMS or not?
Actually didn't find any useful link yet, but I need help that I've created a Email widget and when I drag and drop that I need to add anchor if url added in the field from the Kentico Email CMS if didn't add anything in the anchor field it should not add anchor html.
Please help!
Thanks in Advance.
Here is the Anchor code in the widget:
<td>
Read More
</td>
{% if (Header_Circulation_Link == null) { %}
<div>Its null</div>
{% } else { %}
<div>its not null</div>
{% } %}
Equality checks support all available object types, with the following
special rules:
Empty strings are equal to null
See macro docs for more
I want some simple twig tags that allow me to do the following:
{% customtag 'name' %}
<div> some html </div>
{% endcustomtag %}
And then get that html inside of a service.
I have tried doing this myself but when I finally have al the data that I want inside of my NodeVisitor I can't seem to get it to my service. If I inject it and call a method on it it never gets executed. It only gets called if I try to clear my cache from my command line.
Can somebody please give some insight?
Apparently, you can access your extensions from Twig_Template.
So you can do:
$compiler->write('$this->extensions[')
->string('your_extension')
->write(']->getService()->someFunction();')
->raw(PHP_EOL);
in your twig node. And then in your extension you should just inject the service and return it in the getService method.
I create custom controller(extending Sonata\AdminBundle\Controller\CRUDController) and action.
When render this action {{render(controller('MainBundle:SonataAdmin/Order:searchCertificate'))}}
I get Symfony error:
An exception has been thrown during the rendering of a template ("There is no _sonata_admin defined for the controller MainBundle\Controller\SonataAdmin\OrderController and the current route").
I found answer in official documentation:
If you want to render a custom controller action in a template by
using the render function in twig you need to add _sonata_admin as an
attribute. For example; {{
render(controller('AppBundle:XxxxCRUD:comment', {'_sonata_admin':
'sonata.admin.xxxx' })) }}. This has to be done because the moment the
rendering should happen the routing, which usually sets the value of
this parameter, is not involved at all, and then you will get an error
"There is no _sonata_admin defined for the controller
AppBundleControllerXxxxCRUDController and the current route ' '."
i have solved this Problem by setting the _sonata_admin in the comming request:
with normal Controller:
$request->request->set('_sonata_admin','admin.template');
I'm a new in OroCRM and Symfony2. I'm trying to code a page that retrieves all record of a table. But I don't know how to change title of this page, it always displays it's url (http://localhost/crm-application/web/app_dev.php/...).
This is my twig file:
{#index.html.twig#}
{% extends 'OroUIBundle:actions:index.html.twig' %}
{% import 'OroUIBundle::macros.html.twig' as UI %}
{% set gridName = 'b2b-customers-grid' %}
{% set pageTitle = 'B2B Customers' %}
I have tried many way but i could not make it. I usually get that error:
A template that extends another one cannot have a body”
Any help? Thanks a lot. :)
pageTitle is not that title that you think of, as I understand you want to set title for the whole page, browser window title, head > title in html, and pageTitle variable it's for content header title.
Do you have any other content in your index.html.twig? That could be the reason you got an error.
To set window title, you should use navigation.yml in your bundle's Resources/config with something like
oro_titles:
orocrm_account_index: ~
or
oro_titles:
orocrm_account_index: 'Create Account'
Don't forget to clear cache after that, if you had no this file before and run app/console oro:navigation:init to reload titles configuration
Almost everything's working great in my project, except that when I log in (using facebook) with a user that has no correspondence in my database (FOSUserBundle), I get redirected to /registration/{id} only to get an error:
The form's view data is expected to be an instance of class Naroga\Reader\CommonBundle\Entity\User, but is an instance of class HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse. You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms an instance of class HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse to an instance of Naroga\Reader\CommonBundle\Entity\User.
I also had to overwrite connect.confirm.html.twig to delete the following lines:
{% if userInformation.profilePicture is not empty %}
<img src="{{ userInformation.profilePicture }}" />
{% endif %}
It said PathUserResponse had no profilePicture method. My guess is I should not be using PathUserResponse, but I don't know what I did wrong. Can someone point me in the right direction?
The kind people of HWI/OAuth-Bundle have fixed the issue. I thought I was doing something wrong, but those were actually known bugs.