i was able to add a class to the form itself and for example to a form_row like you can see on the screenshot by adding a second parameter to form_start/form_row and so on. but i was not able to find a solution to add a class to the parent of div.choice-box which already has the class form-group. whats the correct solution right here?
thanks guys
it was quite a simple solution - we have our own template file called fields.html.twig - i just opened the vendor file bootstrap_3_layout.html.twig and copied the necessary parts over into our template file were i was able to apply the needed changes.
have a nice one.
Related
I am trying to build my first own extension with the Extension Builder. Up to now everything worked really well, but now I've got a problem and am not able to find a solution:
My extension looks like this: You can add new Entries in the backend under List (the entry on the right panel). These entries are then shown in the frontend.
While adding new entries there is the possibility in the horizontal navigation bar to link this entry to specific categories. I've already done this with every entry.
But how can I display this category in the fronted. It should be just one <div> like Linked Categories: CATEGORY.
It seems like there is no ViewHelper which can display all linked categories.
I've already googled a lot, but this just confused me more: It seems like its not possible with a simple ViewHelper. There was a solution, where one had to edit the controller. But I did not like this because then I can not continue working with the Extension Builder or it becomes overwritten.
I also looked in the code of tx_news. It seems like all categories are in a variable there, which can be looped. But in my extension <f:debug>{categories} was always NULL.
Is there no ViewHelper which can display the categories, or anything else? Maybe a good tutorial (I am good in PHP, but new to TYPO3).
Thank you very much in advance,
Felix
P.S: I am using TYPO3 CMS 7.6.9
the Extension Builder is just a 'kickstarter' that helps you define your models and actions, relations etc ... It will not do more then that. So once you created your extension draft, it's best to forget about the extension builder and try to understand the structure of an extbase extension (the MVC, TCA, localconfig, typoscript,...). If you need to add a new property, do it manually. You will learn a lot more about your extension and how it works.
Having this said, you will have to adjust your extansion yourself to add categories. There are a few ways to do it: you can add your own category system by adding your own category Model, or use the TYPO3 category API
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html
There is also no plug&play category viewhelper. If you like to be able to list your entries by category, you will need to adjust your controller.
You can add some functionality to an existing on, for ex. your listAction so that it reads arguments send to this action (a list of categories you like to filter on) or create a new one called for example categoryAction.
extbase reference :
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/b-ExtbaseReference/Index.html
stackoverflow question about categories in a controller:
Controllers and Template (how to filter results correctly or give arguments via backend?)
bottom line:
- skip extension builder
- learn how to adjust the MVC yourself
you can always join the TYPO3 slack channel :
https://typo3.slack.com/
it's free and people are very helpfull
good lcuk
1 of the adjustments I want to make is to edit the admin.py file in the controllers list. For example, the function def _get_config_form_items(self):
I want to remove some of the default items, but i don't know how to edit the file without changing it in the core.
Thanks in advance!
If you want to remove some items from the config, I don't recommend you to overwrite that part of the code. First, go through the tutorial for writing an extension. Add to your plugin the iConfigurer interface and now you can remove or update config items.
I have a large form with a image upload field working ok.
Field is defined in model as:
$this->add('filestore/Field_Image','thumbnail_id');
Then I created two tabs inside form:
$tabs=$form->add('Tabs');
$main=$tabs->addTab('General');
$design=$tabs->addTab('Design');
And moved image field to design tab:
$design->add($form->getElement('thumbnail_id'));
Now I can't upload files. When I try I get the following javascript error
Error: cannot call methods on atk4_form prior to initialization; attempted to call method 'submitPlain
Is there any other way to move the field or have upload working again after moving it?
I was trying to use the same method ($design->add($form->getElement('my_element'));) to move a slider into another place on the page. That didn't work - I think it was because the slider input field is not placed on the page the same way as other input fields.
So I tried with the jQuery appendTo-method (I found the hint in a comment from romanish in a documentation page). That worked. But then I experienced the same problem as you - and in the end I gave up and solved the problem by editing the slider-class page.
So I can't help you, sorry, but I guess this points out that there is a general problem related to getting input from moved form elements.
I'm trying to separate the views for the different platforms into different subfolders.
I have done this for the layout, at the moment I have the following:
class MoviesController < ApplicationController
layout :site_layout
def site_layout
if(iphone_request?)
"iPhone/movies"
else
"movies"
end
This means that in my action methods I don't need to include :layout, however I do still need to manually include the path to the template.
format.iphone {render :template => 'movies/iPhone/index'}
Is there a way to have the same kind of layout declaration but for templates?
Thanks
Ben
You may want to extend the view_paths so that you can have a special iphone subfolder under views and override templates as necessary. See this tutorial on how to do that.
However, is there a reason you don't want to use the iphone format in the view name (show.iphone.erb) instead of making a subfolder? See martinkl's answer in your other question for details.
I might be off, but maybe it'll help - try checking prepend_view_path.
I came across the case where depending on the execution path I may need to invoke an inclusion of .js file from controller. Is there a nice way of doing it? (besides setting some view variable with actual .js include code)?
See the view helper headScript(). I'm just writing this off the top of my head but I think it works like this:
From within a view file: $this->headScript()->appendFile('filename.js');
From within a controller: $this->view->headScript()->appendFile('filename.js');
And then somewhere in your layout you need to echo out your headScript object:
<?=$this->headScript();?>
Sure, you could do like #Bill Karwin described.
But if you would like to do it really nicely, you need template inheritance - like it is implemented in Django framework for Python for instance. There are some extensions for Zend Framework as well, take a look at Calypso.