typo3 tx-news create a custom record type - typo3

i know how to create new news types thats stated here https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/ExtendNews/AddCustomType/Index.html
But is it possible to extend it so that i can make a complete unique record type?
For example:
I want something like: "News Tag 2" - so a different type of record with different fields i can save.
Is that possible?
Thank you.

You can do that by writing your own extension which contains the new type as Exbase model. Then you can attach it to the news record by extending the news domain model

Related

Typo3 9.5 : Add a new field to a new page type

I make a new page type with the help of this doc : https://docs.typo3.org/m/typo3/reference-coreapi/9.5/en-us/ApiOverview/PageTypes/
I want now to customize it by adding a new field to my page
For example a field under "title" field
I checked the doc and didn't find how to do this
Some one can explain me how to custom my new page please?
Thanks
extending pages records is the same than extending tt_contentrecords.
there is a an example to this in the documentation: extend tt_content and use data processing.
This link is to the documentation of TYPO3 11 as this version is state of the art and gets support. For older versions the declarations may vary a little, but the concept is the same:
add new fields in database and TCA.
create a variant (type) and declare which fields should be shown for this variant.
you may need additional getter and setter or controller for this variant

Yii2 adding parameters to the model with a function

I have two types of data. Articles and article types. They are stored a postgres DB. Every article instance should have particular type. All articles have common properties like "name", "create_date" and so on that are in every article and fields that are specific for the specific type like "some_image", "ingredients", and so on for the type1 and "images" and "points" for type2.
The additional properties for the specific type are stored in a single json column in the db table.
When the url "some_path/articles/create/2" is opened a form for creating an article of type 2 is displayed
I have an Articles ActiveRecord model and ArticlesController.
My problem is that in the model I have only have the common properties. And the additional properties are always different.
I need a method in the model or in the controller with which I can add the additional properties with the proper rules and all (like the common properties in the model) and then in the view I can render all fields without difference.
Is there a way this to be done and how?
I read how this can be done with Javascript, but I want it to be dobe before page rendering, not after that
May be this can help.
Use Scenario in your model
Model class has scenario function which you can inherit.
User Register Scenario - Required - username, password, email
User Login Scenario - Required - username, email
public function scenarios() {
$scenarios = parent::scenarios();
$scenarios['login'] = ['name','password'];//Scenario Values Only Accepted
return $scenarios;
}
and you can use it as

How to disable Edit/Hide/Delete in TCA for TYPO3 Extbase Domain Model?

As the title already says, I want to make a specific Extbase domain-model completely "read only" .. It is a custom Log-Entry model that shall be viewable but must not be modified via backend (they are being generated during certain controller actions).
I do not use the TYPO3 log system intentionally, because I want to have a separate log with its own db-table etc.
I do know about the readOnly property for columns, but I`d like to disable any modification-functions in the list view also.
Thanks in advance, Oliver
There's not only option "readOnly" for columns, this option can also be set for the whole table:
$GLOBALS['TCA']['yourTable']['ctrl']['readOnly'] = 1;
Have a look at EXT:static_info_tables, the records from this extension are not editable.

TYPO3 Extension Error: Cannot create empty instance of the class

My FE plugin created using extension builder shows me the following error :
Cannot create empty instance of the class "TYPO3\CMS\Extbase\Persistence\ObjectStorage" because it does not implement the TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface.
What does it mean and how do I resolve it?
TYPO3 version 6.1.0
My Domain Object named Subject has relations Category_Id m:n relation and Location_Id 1:n relation . I did not map these two to any table during the creation of the extension.
How do I mention this in the extension that these relations are related to certain tables (Category_table and Location_table)and are to be looked in their respective domain model objects to retrieve data ?
The problem is a little confusing, I hope I made myself clear
Thank You
You need to set up the relation within the TCA.
Make sure to clear the cache and to remove the typo3temp/Cache/.
Then you will need to annotate your model properly such that extbase can resolve the reference.
Remember: TCA for core and annotation for extbase

Symfony2 - the good way to add an image in our entity

Actually I have a "Movie" entity and I want to add a new attribute like "picture". Of course I have to add this attribute in my entity "Movie".
But I was wondering if I have to set some parameters like size, extension in my mapping comments.
Then, as I have not created yet my add for and edit form... I add manually datas in my database for testing my scripts.
Does the "picture" column contain only the name of the image like "toto.png" ?
If it's the case, what is the directory which will save the images ?
Assuming you use Doctrine as ORM, I suggest reading up on file uploads in the Symfony documentation. It describes the fields to create, form and upload handling. But yes, you basically store the filename in the field "picture" and create additional functions to help figure out the true path to the file.