TYPO3 7.3 extbase how to retrieve blob data? - typo3

We're migrating a 4.5 extension to 7.3 and we have blob values stored in mysql "longblob". Building a file from this blob value does not work any more.
The Extbase Variable Dump of the "blob" value is "NULL". Is there any example how to work with blob data with the new extbase?

Found the issue in TCA, did not realised that internal_type now implicit adaptions to keep the same behaviour as an 4.5. Changed to classic text made it work as expected.
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'uploadfolder' => 'uploads/tx_exasopmanager',
'show_thumbs' => 1,
'size' => 5,
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowed' => ''
),

Related

How to get 'friendly' text of a TYPO3 MultiSelect field in the TYPO3 Fluid template?

I have a multi select field that is defined by TCA that way:
'type' => [
'exclude' => true,
'label' => 'LLL:EXT:extension/Resources/Private/Language/locallang_db.xlf:tx_extension.type',
'config' => [
'type' => 'select',
'renderType' => 'selectCheckBox',
'items' => [
['LLL:EXT:extension/Resources/Private/Language/locallang_db.xlf:tx_extension.type.b', 'b'],
['LLL:EXT:extension/Resources/Private/Language/locallang_db.xlf:tx_extension.type.w', 'w'],
],
'size' => 1,
'maxitems' => 2,
'eval' => 'required'
],
],
In the backend form everything works as expected, but when selecting the data in a frontend controller from the database, for example by ->findAll(), I only get 'b', 'w' or 'b,w' as values.
Is there a simple way to get the 'friendly' names?
When using relations to other tables, the values are getting resolved, but not when using static items as values for the select.
I was thinking about using the translate view helper <f:translate key="{value}" extensionName="extension" /> but this will fail when more than one item is selected.
Then I was trying to write an own view helper but failed with the initialisation of the translation factory service (that does not exist in TYPO3 v8.7!!!). Then calling the TranslateViewHelper::renderStatic() method failed because I did not find a way to get the RenderingContextInterface what is needed as third parameter.
Anyway, isn't there a smarter way to solve my problem (in good old TYPO3 v9 ☹️)?

TYPO3: How to set up textfield in custom content element to avoid missing file references in backend filelist?

How to set up textfield in custom content element to avoid missing file references in backend filelist
I have a custom content element with a field of type "text". When I link in this field to a file in fileadmin there is no reference counted in the backend.
How I have to configure the field in my TCA to regard the references from that field in the file list?
My TCA-Config for that field is:
'my_ext_fiedname' =>
array(
'config' =>
array(
'type' => 'text',
'eval' => 'required',
'richtextConfiguration' => 'default',
'enableRichtext' => '1',
),
'exclude' => '1',
'label' => 'title',
),
Try to avoid using media references in text fields. It has been difficult over the past years to upgrade TYPO3 with such configuration and usages.
If you can't avoid, try using extension rte_ckeditor_image from Christian Opitz which is regularly maintained.

internal_type file_reference in type group in TYPO3 8 LTS

I tried the following tca:
'file' => [
'config' => [
'type' => 'group',
'internal_type' => 'file',
'allowed' => 'gif,jpg',
'max_size' => 1000,
'uploadfolder' => 'uploads/pics/',
'show_thumbs' => 1,
'size' => 3,
'minitems' => 0,
'maxitems' => 200,
'autoSizeMax' => 10
],
],
which i took from an example in the doumentation. But instead of file i need
'internal_type' => 'file_reference',
which throws the following error when using the wizard in the backend:
#1288965219: $className must be a non empty string. (More information)
InvalidArgumentException thrown in file
typo3_src-8.7.8/typo3/sysext/core/Classes/Utility/GeneralUtility.php in line 3874.
Any idea why this does not work?
Thanks!
It is not recommended to build TCA for FAL relations yourself. You should use the TYPO3 API for that instead.
it is a bug in typo3 core. In the file
/typo3_src/typo3/sysext/recordlist/ext_tables.php
are three element browsers defined:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['db'] = \TYPO3\CMS\Recordlist\Browser\DatabaseBrowser::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file'] = \TYPO3\CMS\Recordlist\Browser\FileBrowser::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['folder'] = \TYPO3\CMS\Recordlist\Browser\FolderBrowser::class;
an element browser for file_reference is missing. But there is no special browser needed - the only difference between file and file_reference is where the files will be saved, and this is not the task of the element browser. If i add this line:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference'] = \TYPO3\CMS\Recordlist\Browser\FileBrowser::class;
all works as expected.
I posted it on forge:
https://forge.typo3.org/issues/82873
so it is easy to fix: i added the following lines in my ext_tables.php:
if (TYPO3_MODE === 'BE') {
// activating file browser for file_reference:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference'] = \TYPO3\CMS\Recordlist\Browser\FileBrowser::class;
}

Disable image processing

How can i disable the processing of images while element is being saved? when i edit the html of a text-element and add an image with a relative path, the editor creates an absolute path and furthermore processes the image. the image is copied to a new folder and the src-path is adjusted. i want to get rid of this behaviour. it this possible, so i can just set the src-attribute of the image and it will stay like that?
I'm using the extension "TinyMCE".
In the TCA of your extension, remove the configuration parameter 'uploadfolder'. This will lead to the behaviour that the file is referenced to the original location instead of being copied. See the TCA reference for more information.
The configuration might look like this:
'image' => array(
'exclude' => 0,
'label' => 'LLL:EXT:yourextension/Resources/Private/Language/locallang_db.xml:tx_yourextension_domain_model_yourmodel.image',
'config' => array(
'type' => 'group',
'internal_type' => 'file',
'show_thumbs' => 1,
'size' => 1,
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowed' => '',
// removing/commentingthe next line will create a reference instead of copying the file
// 'uploadfolder' => 'uploads/tx_yourextension', //
),
),

Typo3: Using TCA type group with FAL

Is it possible to use FAL in TCA with the type group?
Based on the doc where say…
elementBrowserType (string) (since TYPO3 CMS 6.0) Makes it possible to
set an alternative element browser type ("db" or "file") than would
otherwise be rendered based on the "internal_type" setting. This is
used internally for FAL file fields, where internal_type is "db" but
the element browser should be the file element browser anyway.
…I tried following:
'config' => array(
'type' => 'group',
'internal_type' => 'db',
'MM' => 'sys_file_reference', // with and without this option
'uploadfolder' => '',
'minitems' => 0,
'maxitems' => 99,
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
),
'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
),
…and much more, but it wont work.
Any hints?
You need to use the API: \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('media') (taken from core\Configuration\TCA\pages.php).
http://api.typo3.org/typo3cms/master/html/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_utility_1_1_extension_management_utility.html#ab95ff2f805d3ec462e869057339eee04