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

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

Related

typo3 tx-news create a custom record type

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

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.

Extbase: get/save specific language of object

In a CommandController, I need to sync objects with an external source. The source is multi-language and shall be mapped to localized records in Typo3.
I just seem too blind to find options to ...
a) get records in a specific language
b) add/update records in a specific language
... (from a CommandController context).
I was expecting this to be a function of the model (AbstractEntity) or maybe the repository, but could not find any public lang/sys_lang/localize-functions there.
(Typo3 version 6.2)
You can write a method in your repository class to get all records with the sys_language_uid you need and use that method to get all the records.
If you model does not have the sys_language_uid, add it so you can use it in your controller.
(if your model has sys_laguage_uid, you can use $yourrepo->findBySysLanguageUid(1) )
Probably you need to change the defaultQuerySettings so you can retrieve the any language, regarding the site language (if you are using a FE ext)
adding the records with a specific language is $yourobject->setSysLangUid(1); (or whatever lang id)

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.