Below are just notes on some small tasks which are not long enough to be put in a single blog post.
Enjoy !!!!
Setting display/sorting order of records for a table in the List-Module in TYPO3
Lets say we want to set the display order for records from a table based on a “text” field of the database table like for example title. To set this,
Go to the Configuration/TCA/Overrides folder of an extension and create a .php file with same name as the table whose sorting order you want to set. Create the Overrides folder if it doesn’t exist.
Assuming the table name is tx_customextension_domain_model_custom, put the code below in the created file.
$GLOBALS['TCA']['tx_customextension_domain_model_custom']['ctrl']['default_sortby'] = 'title';
You can also use multiple fields of the table and also set a sorting order like below
$GLOBALS['TCA']['tx_customextension_domain_model_custom']['ctrl']['default_sortby'] = 'title ASC, bodytext DESC';
Note: Please, do not use sortby. Like in
$GLOBALS['TCA']['tx_customextension_domain_model_custom']['ctrl']['sortby'] = 'title'
The field set here should contain integer values and the TYPO3 DataHandler manages the content of this field automatically.
If you set sortby to title like above, the TYPO3 Datahandler is going to update this field with integer values and this is going to cause you a lot of problems like when carrying out some operations on this table’s records in the List-Module.
This happened to me and almost drove me nuts until I found out that this was the problem.
Disable cHash for an extension’s plugin
Sometimes when creating Ajax requests in TYPO3, we need to manually create the url to a controller action for the Ajax request. In this case, we can’t set the cHash argument in the url as this is automatically generated by TYPO3.
So, we have to disable it if not we will get a “Request parameters could not be validated (&cHash empty)” error. Follow the steps below to set this.
Assume your extension’s name is my_extension and the plugin’s name is MyPlugin. This plugin name is the second argument of the configurePlugin() method for the plugin’s configuration found in your extension’s ext_localconf.php .
The controller action you are creating the ajax request to must be allowed in the plugin. This can be checked in the extension’s ext_localconf.php file. It is the 3rd argument of the configurePlugin() method for this plugin’s configuration.
- Open the
my_extension/Configuration/TypoScript/setup.(typoscript/txt)file of your extension. - Add in the code below
plugin.tx_myextension_myplugin {
features {
requireCHashArgumentForActionArguments = 0
}
}
- Log into the backend and Flush all caches.
Now, your ajax request should work without it requiring the cHash argument in the url.
Exit git log command
Press Q button.
.gitignore – Ignore everything in directory except a specific subdirectory or file
Sometimes when working with Git, we want to ignore all the contents of a folder except some specific sub folders or file(s). Below is how to do that.

Assume we have a folder structure as above. The public folder is in the repository root (that is, the same directory as the .gitignore file).
We want to ignore everything in the fileadmin folder except the brand, user_newUploads, user_upload folders and the newFile.text file. The .gitignore file will be.
/public/fileadmin/*
!/public/fileadmin/brand/
!/public/fileadmin/user_*
!/public/fileadmin/newFile.text
Note: Using !/public/fileadmin/user_*/ or !/public/fileadmin/user_* is going to give you similar results. I didn’t really find the difference between these two.
After updating the .gitignore file, follow the steps here to refresh/update to Gitignore so your changes take effect.
If everything done well, your Gitignore should work as expected.
So, that is all for this article. Any issues, just drop in the comments.
Leave a comment