Disable image processing - typo3

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', //
),
),

Related

Update reference index in fields with rendertype inputLink

Links to files or images in fields which use the renderType inputLink (e.g header_link in the normal content elements) do not update the reference index when the content element is saved.
My TCA:
'config' => [
'type' => 'input',
'renderType' => 'inputLink',
'size' => 50,
'max' => 1024,
'eval' => 'trim',
'fieldControl' => [
'linkPopup' => [
'options' => [
'title' => '',
],
],
],
'softref' => 'typolink'
(the same as in header_link in the content elements)
Is there a possibility to force the correct handling of the reference index? The editors can't see which files are linked and which not, so they can delete the files in file module without error message.
Thanks
this bug was fixed with TYPO3 9.7.12:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/62205

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.

How can we add new fields in a new tab in user setting in TYPO3

How can we add new fields in a new tab in user setting in TYPO3 version 8.7?
Our problem is the creation of a new tab.
I can add new fields to personal data tab in user setting, but I need to create new fields into a new tab.
For backend admin user setting I added a new tab, but for user setting I want to try this. I have an extension and since the installation of the extension it will add-on.
I tried to create new tab in fe_user.php.
Previously I tried to change ext_tables.php, but that is not working at all.
// Add some fields to FE Users table to show TCA fields definitions
// USAGE: TCA Reference > $GLOBALS['TCA'] array reference >
// ['columns'][fieldname]['config'] / TYPE: "select"
$temporaryColumns = array (
'tx_examples_options' => array (
'exclude' => 1,
'label' => 'tx_examples_options',
'config' => array (
'type' => 'select',
'showitem' => array (
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.0', '1'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.1', '2'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.2', '--div--'),
array('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:fe_users.tx_examples_options.I.3', '3'),
),
'size' => 1,
'maxitems' => 1,
)
),
'tx_examples_special' => array (
'exclude' => 1,
'label' => 'tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'fe_users',
$temporaryColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'--div--;newtab,tx_examples_options, tx_examples_special'
);
When I changed into file ext_tables.php
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['copy_directory'] = array(
'label' => 'Alternative directory for saving copies',
'type' => 'text',
'table' => 'be_users',
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('copy_directory','after:lang');
then it's showing in "personal data" tab but I want new tab in user setting for non-admin user.
In general your code looks fine.
But you are in the wrong file!
Avoid ext_tables.php if possible.
If you change anything to the TCA you should do it in Configuration/TCA/ for new tables and Configuration/TCA/Overrides for enhancing existing tables.
Use filenames according to the table you are modifying.
In your case all the code should be located in Configuration/TCA/Overrides/fe_users.php.
And be sure you clear all caches if you develop anything with TCA!

How can I create custom file upload field in opportunities

I'm working with sugar 8.3. I'm trying to create custom field for upload documents.
I have create vardef file, but when I click on save record, file uploaded properly but not display in record.
custom/Extension/modules/Opportunities/Ext/Vardefs/custom_upload.php
<?php
$GLOBALS['dictionary']['Opportunity']['fields']['filename'] = array (
'name' => 'filename',
'vname' => 'LBL_FILENAME',
'type' => 'file',
'dbType' => 'varchar',
'len' => '255',
'reportable' => true,
'comment' => 'File name associated with the note (attachment)',
'importable' => false,
'source' => 'non-db',
'docUrl' => 'doc_url',
);
$GLOBALS['dictionary']['Opportunity']['fields']['file_mime_type'] = array(
'name' => 'file_mime_type',
'vname' => 'LBL_FILE_MIME_TYPE',
'type' => 'varchar',
'len' => '100',
'comment' => 'Attachment MIME type',
'importable' => false,
'source' => 'non-db',
);
$GLOBALS['dictionary']['Opportunity']['fields']['file_url'] = array (
'name'=>'file_url',
'vname' => 'LBL_FILE_URL',
'type'=>'varchar',
'source'=>'non-db',
'reportable'=>false,
'comment' => 'Path to file (can be URL)',
'importable' => false,
);
Before save attachment screenshot
After save attachment screenshot
The whole scenario is not very clear from the code you have provided, i think that you should remove 'source'=>'non-db', attribute from these fields so that they get saved in database.
Don't forget to perform Repair and execute queries that gets generated in result of repair so that Sugar create appropriate fields in opportunities table for saving you uploaded file data.

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