show checkbox instead of 1 and 0 in drupal 8 table - drupal-8

I would really appreciate you to help me with this.
The problem is: I'm trying to show a checkbox on each row depending on the value of an entity field, more or less like this
$row['access'] = [
'#type' => 'checkbox',
'#value' => $entity->getAccess()
];
But none of that has worked, and I can't find almost any documentation on how to do such thing. please help me

Ok, so, what I ended up doing was a custom template, just as suggested by previous comments. But, instead of using the EntityListBuilder I made a custom controller that rendered the custom template passing the entity array as a variable. Thank you very much, all your suggestions were a lot of help.

You could use the EntityListBuilder::render function and override the table.html.twig template.

You can use twig and theme suggestion to theme your field, override the template and theme the field depends on the state.
To override the template you could do that by theme-suggestion
To theme your field That can help you
Another thing :Debugging Twig templates
With the #Steve Mulvihill's reply, I think you can do the job :)
Hope that helped you...

Related

Django: How to add fields in form from a button without javascript

I saw a what might be a solution to my problem here but i tried to understand and implement the code on what is indicated in the solution with no avail.
As what I understand( if correct ), in the views, the use of cp = request.POST.copy() is to copy what is in the form and then the use of cp['prim-TOTAL_FORMS'] = int(cp['prim-TOTAL_FORMS'])+ 1 is to add the field but from there I am lost
Sorry for my newbie question because I am very new to django.
Any pointers, suggestion, or even a sample code would helpful and much appreciated.
Thank you in advance.
I am currently working to figure this out myself. The best I could come up with is an a input type="number" and a separate input type="submit" with an "add rows" action. We can check the add rows with request.POST.get('action') to see if we are submitting for review or adding additional forms. This is as far as I am currently. I can read the number input, but when I pass it to the formset_factory via the extra attribute. Have you solved this?

Determining parent page of template

Inside a Grails GSP template (e.g., _form.gsp), how can I determine what page is calling the template (e.g., create.gsp or edit.gsp) so that different fields can be displayed?
There is no general way, no. If you just know that in your application that the foo action always renders the foo view and there aren't exceptions to that, then of course you can just look at the action name. You could also do something simple like put something in the model when rendering the template, like <g:render template="foo" model="[parentPage:'edit']"/>, or set a variable in pageScope or similar. There are ways to accomplish what you want, but no general way in a template to answer the question "What GSP rendered this template?". I hope that helps.
So I googled it without any mention of templates (gsp determine current page) and found the answer on this Nabble thread. I will use params.action to determine what action I'm currently doing (e.g., create or edit), and use that to display different fields.
Cheers!

joomla 2.5 and template with font awesome

probably a stupid question, but I can not figure out where to go to give the name of the font (which is already in the native template) within the code of Joomla 2.5 to insert the icon next to the title of a menu'. Thank you very much for the help...
Simone
Far from a stupid question, this is the method I use.
See the post from Mark Vink at Add custom element to home menu item in Joomla .
See also my comment on the same post for details on how to make a template overide for /modules/mod_menu/tmpl/default.php
Good luck!

Twitter Bootstrap's ".input-prepend" with a Django Form

I'm new to Django and have been using django-bootstrap-form. I've been pretty happy with it, but I don't believe it provides a way to format the output for ".input-prepend" as described in Twitter Bootstrap's docs.
I'm guessing I'm going to have to override my input field's widget for this particular field. I'm not sure of the best way to do this, though. Any help would be appreciated.
You'll have to edit the templates, adding an if clause for prepending and possibly two more for appending or both cases at once or handle this with a templatetag (or beter even, the widget render method).
Have a look what's there to get the hang of it.
For the field itself either create a custom formfield or create a widget by wrapping a basic widget.

Redesigning the node comment while using the nodecomment module

I am using nodecomment module in drupal 6.2. I need to change the design, look and feel of the comments attached to each node. Since i am using the nodecomment module so , i added few extra fields to the comments which needs to be repositioned and redesigned.
Being a novice in drupal, I have absolutely no idea how do i proceed. Please help
Thanks in advance :)
You can go fairly far with CSS and the "Manage Fields" and "Display Fields" settings of your content type. For more in-depth changes, you can override the node-comment.tpl.php for the comment nodes and view templates for different listings of contents.