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 ?
Related
I have an entity page and i would like to add blocks of different types and display them in the form when i select one (Image, text and image or just text). All dynamically without being pre-defined in the administration (like a cms).
HomePage
title
description
blocks [text, text-image, image]
if text create new field text
if text-image create new field text and new field image
if text again create new field text
I dont know how to make a form to be like reapeater one with adding new block or removing existing one.
I can't comment so I will put an answer instead.
I am not sure I get your question. If you're trying to configure the fields, you need to configure them in your CrudController:
TextField
ImageField
etc. as per the documentation
If you're trying to have a more CMS like approach, where you can move things around, you may want to check SonataAdmin instead. It is much more complicated but provide CMS capabilities EasyAdmin does not.
I installed to my Symfony2 below bundles:
SonataAdmin
SonataUser
I would like to create block which would be able to be edited in admin. I thought that installing of them and using sonata_block_render with sonata.block.service.text would solve my problem. But there is only short text
Insert your custom content here
When I can edit that?
Could I make it, that I can edit in Admin Panel?
Short explenation about what concept I have:
I would like to create blocks text/content/html or something similar which would be saved in database and I would be able to edit them in admin panel. Each of block I would be able to "inject" to templates via some helper.
My question is: Am I going good way to that and what next? If not, what I have to do?
Use sonata/formatter, the install/usage doc is quite clear.
You can either create a template or create a whole block service that inherites from FormatterBlockService if you want to override the default text "Insert content here". After sonata-formatter installation, the important part is to implement the twig filter that transform the mardown/twig/wathever into rich html in your public website views. This is not the default rendering. See this comment in the Sonata formatter Github repo
In Drupal, I would like to display some user related nodes on their "My Account" page. I would like to do so by creating a View that i would add as a field on the user entity (through admin/config/people/accounts/display). I could use Computed Field in order to load and render the view but that is not very convenient as it requires me to write PHP code.
In short, is there a module that allows to add dummy fields containing a view in the "manage display" sections of entities?
Thanks for your help.
Yes, Viewfield. This allows you to reference a view and renders it.
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) }}
By default for creating content a new page is opened. I want to do this inside a block. A block where there will be some fields like title body taxonomy terms and a create content button. How can I do this?
The form block module will do what you want.
You could you do the same thing in code, using hook_block to create a block. And using
drupal_get_form to render the form.
Try the Panels module.
http://drupal.org/project/panels
It will let you override and re-arrange the node add/edit form.
But, as Jeremy stated, to use this form on other pages of the site you will need to do something custom like hook_block and invoke drupal_get_form.
I agree with the answers from Jeremy and Kevin, but want to give another one.
You can use views to create the block! All you have to do is create a new view display with a block display. Add the fields you want to show, add a link field for the node/add/foo link and give it a node id filter or default argument. Here you have to choose the node id of the node to display in the block. Done!
What's nice with this solution? You can use almost every feature of views theming, drag and drop field ordering, adding new fields is cheap and no extra modules. ;)
Regards
Mike