Concrete5 8+: Set a custom controller for a block - concrete5

Does anybody know the way how to set custom controller for a block?
Concrete documentation suggests the way of overriding block's controller via application/block/block_name folder.
The thing is that approach will override controller for all templates. What if I have a few block templates and don't want to override controller for all templates?
The only way I see - creating a new block type. But I don't think it's a right way.

Unfortunately there isn't a way to have a different controller for a block template, you have to create a new block type.

Related

EasyAdminBundle - Custom Block for show view

I'm using the EasyAdminBundle for SF and I have a show view for an Entity, where I list like id, username and password. What I would like to do is simply render one more row where I deliver the content from a custom template.
what is the easiest way? I didn't found a solution yet with YAML. Do I need to overwrite the whole show.html.twig ?

EasyAdminBundle: Add a custom view that's not based on entity

I'm currently experimenting with EasyAdminBundle:
I want to add a menu item that calls a custom controller and renders a view. The view is not based on an entity but should rather display the results of a csv import.
What I have done so far is:
create Controller and render the results into a new twig template.
add the menu item to config and call my Controller with the option
'route'
The twig template is pretty basic for now. It extends from "EasyAdminBundle:default:layout.html.twig" and overwrites the block "main" in order to display the import results.
Now my problem is that it does not seem to find the css for the layout twig?
My results show a plain html page without any formatting :(
Any hints or suggestions how I can render the view with all the styles from the default views?
Also note: I don't want to overwrite the default layout template for the whole backend and I also don't have a specific entity where I could assign a special layout file. Thanks for your help.
found the problem. So the setup as described was ok except that we had some internal project config (that I was not aware of), that would make the response to be returned as json instead of html.

SilverStripe default email style

Is it possible with SilverStripe 3 to create a default email template/style which is applied to all sent emails, without have to to override each email template separately?
Ideally this could be done as part of a theme.
I've tried defining a custom GenericEmail.ss template but it's been ignored thus far.
Looking at the framework source, creating a custom Email class and overriding the parseVariables() could possibly achieve it, but it seems like overkill?
After trying just now, the default email template can effectively be overriden with a custom one. I put mine under the "templates" folder of my theme (and not in any subfolder), ie
/themes/mytheme/templates/GenericEmail.ss
Then tested after a flush=1 (so that the new template is picked up)
Hope this helps

Using KnpMenuBundle in Symfony2 for menu of Entities?

I have a User entity and all users have many Category entities. I have a controller which accepts a Category slug as a parameter.
I would like to render a menu that lists all of the Category's of a User as links to that controller. I would also like to mark one as "current" if they are on that page already.
The KnpMenuBundle looks nice for this https://github.com/KnpLabs/KnpMenuBundle/blob/master/Resources/doc/index.md
But all of its examples use a static menu that is built up, rather than building the menu from dynamic items. I thought about getting the items in the Builder, but I already have them in the controller that ultimately renders the twig template, so I would rather somehow pass these Category's to the Builder and let it handle rendering a menu.
What is the best way to do this?
My other idea is to just do the menu myself in twig, but I would need extra logic to determine which page is "current"
I know that this might not be useful to you anymore but for others viewing the question maby this is helpful.
Since recently it is possible to send your own variables from twig to the builder.
It's done like this as noted in the Documentation:
{% set menuItem = knp_menu_get('AcmeDemoBundle:Builder:mainMenu', [], {
'some_option': 'my_value'
})
%}
{{ knp_menu_render(menuItem) }}

theme specipic element in form api drupal6

how can i theme a specipc element that created by node form? i saw mytheme_checkbox etc but i want to do phoneselect_theme() { } and change there the value or whatever
You should be able to use the Theme Developer module to find which function or template file is outputting the part of the page you're interested in theming. Theme Developer will also tell you what "suggestions" you can use to override the output. Check out the Theme Developer screencast for an introduction on how to use the module.
Implement a form alter hook in your module, and then use the #theme attribute inside the alter hook to override the form element's theming.
You'll want to know the exact form ID of your form. This writeup by Lullabot will tell you how to find the form ID and it will give you an example of how to modify forms.
Don't forget to register your new theming function using the theme hook.

Resources