How to end typo3 realurl with .html - typo3

I'm using the realurl extension to make nice urls, only they all end with the / char. How can I let them end like a .html file?
/path/to/page/
Would like to have:
/path/to/page.html

In your realurl configuration file (usually typo3conf/realurl_conf.php1) there is a section fileName. In it there is a key defaultToHTMLsuffixOnPrev. Set it's value to 1. Should look somehow like this afterwards (generated by realurl autoconfig):
'fileName' =>
array(
'defaultToHTMLsuffixOnPrev' => 1, // <-- Important part
'acceptHTMLsuffix' => 1,
'index' =>
array(
'print' =>
array(
'keyValues' =>
array(
'type' => 98,
),
),
),
),
1 If you used realurl autoconfiguration, the configuration file is generated to realurl_autoconf.php. Make sure to set the auto configuration format to plain PHP-code in the realurl-settings in the extension manager, then delete typo3conf/realurl_autoconf.php to trigger regeneration, and copy the regenerated file to typo3conf/realurl_conf.php.

Related

TYPO3 9.5.x with news 7.2.x: Custom properties

I've extended TYPO3 9.5.x with news extension 7.2.x with some custom properties.
I used the manual I found here.
In general, everything works, but somehow the custom properties I created seem to be blank at the frontend. After clearing the cache, everything works again, but after some time the same issue appears again.
What am I doing wrong? Maybe it has something to do that I'm working with TYPO3 9.5.x and the manual is written for TYPO3 7.6.x?
Thanks for your help!
move your TCA modifying code (from ext_tables) to /typo3conf/ext/yourEXT/Configuration/TCA/Overrides/tx_news_domain_model_news.php
something like this:
defined('TYPO3_MODE') or die();
( function( &$tca) {
$tempColumns = array(
'NEW_FIELD' => array(
'exclude' => 0,
'label' => 'LLL:EXT:yourEXT/Resources/Private/Language/locallang_be.xlf:tx_newsextend_domain_model_news.NEW_FIELD',
'config' => array(
'type' => 'check',
'default' => 0
),
),
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tx_news_domain_model_news',
$tempColumns
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes("tx_news_domain_model_news", 'NEW_FIELD', '', 'after:title');
})( $GLOBALS['TCA']['tx_news_domain_model_news']);

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 to set configurations for use in TCA/Overrides or how to configure sys categories?

For an extension i like to use sys_categories that are stored in a dedicated folder. How do I configure the folder and access the configuration inside the TCA setup?
I tried this approach. I use the method \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable inside Configuration/TCA/Overrides/tx_xref_domain_model_project.php.
Where I place the hardcoded 333 I would like to use a configuration value in the ideal case tsconfig. Is it parsed and accessible at this point?
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
'xref',
'tx_xref_domain_model_project',
'areas',
array(
'label' => 'Areas',
'exclude' => FALSE,
'fieldConfiguration' => array(
'foreign_table_where' => ' AND sys_category.pid = 333',
)
)
);
Is there a more easy approach to solve this?
Using ExtensionManagementUtility::makeCategorizable() in Configuration/TCA/Overrides/<your_table>.php is exactly the right approach and in fact what TYPO3 itself does.
At least the global extension configuration is accessible at this point.
https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/ConfigurationOptions/Index.html
This is not fully satisfying, as you may want to define a different category source folders for different pages or sys_folders. Yet it will do for many projects:
$areaFolder = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)
->get('xref', 'areaFolder');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable(
'xref',
'tx_xref_domain_model_project',
'areas',
array(
'label' => 'Areas',
'exclude' => FALSE,
'fieldConfiguration' => array(
'foreign_table_where' => ' AND sys_category.pid = ' . (string) $areaFolder,
)
)
);

How to add custom wizards in typo3 7 TCA?

When I try to add the wizard named wizard_geo_selector in TCA ,there arised an error "module not registered".Please tell me how to register the wizard properly in the TCA.?
In TYPO3 Version 7.6 new wizards are added like this:
Inside your extension create the directory Configuration/Backend/
In the new directory create a file Routes.php, it will be found automatically, no mentioning in ext_localconf.php or ext_tables.php is required. If you still need Ajax you can add the file AjaxRoutes.php in the same folder.
Content for Routes.php:
return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
Content for AjaxRoutes.php
<?php
/**
* Definitions for routes provided by EXT:backend
* Contains all AJAX-based routes for entry points
*
* Currently the "access" property is only used so no token creation + validation is made
* but will be extended further.
*/
return array('my_ajax_element' => array(
'path' => 'tx_geoselecotor/my_ajax_route',
'target' => \Path\To\your\class\MyAjaxController::class .'::myAjaxFunction'
));
If you're unsure about the notation you can compare with existing entries in the Global Variables in the Backend:
Navigate to System -> Configuration -> Backend Routes
The route of the paths is handled different, for Ajax it's always "ajax" prepended, so you've never to add it to the path, else it's twice in the route. For the common route there is no change concerning the defined string.
Now the wizard can be used and even it never has to be defined in ext_tables.php it has to be mentioned there from any table-field in the configuration-area (module[name]):
'table_field_for_wizard' => array(
'label' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xml:table_name.tx_myextension_wizard',
'config' => array (
'type' => 'user',
'userFunc' => 'Path/to/class/without/wizard->renderForm',
'wizards' => array(
'my_wizard' => array(
'type' => 'popup',
'title' => 'MyTitle',
'JSopenParams' => 'height=700,width=780,status=0,menubar=0,scrollbars=1',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/img/link_popup.gif',
'module' => array(
'name' => 'my_wizard_element',
'urlParameters' => array(
'mode' => 'wizard',
'ajax' => '0',
'any' => '... parameters you need'
),
),
),
'_VALIGN' => 'middle',
'_PADDING' => '4',
),
# Optional
#'softref'=>'something',
),
),
In the userFunc Path/to/class/without/wizard->renderForm you've to create a button which is linking to the wizard and onClick the wizard will open with the route you defined in Routes.php and the optional urlParameters.
Currently I never found this whole item explained in the core-documentation.
Edit:
Details about routing can be found here: Routing
The rendering process can be found here: Rendering / NodeFactory
You should probably read also the outer context of the linked paragraph.
Edit 2:
An example extension can be found here, some things never work 100% but the wizard is working. The extension is for TYPO3 Version 7:
https://github.com/DavidBruchmann/imagemap_wizard
Ricky's answer doesn't really work anymore, since addModulePath ist deprecated since version 7.
Also, just registering the module like this still give's you said error.
The only thing that keeps the wizard going again is this:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('wizard','pbsurvey_answers',"",\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY).'wizard/');
But when you add this, the module appears as a new point in your TYPO3 backend.
IN TCA add the wizard like follows:
'module' => array(
'name' => 'wizard_geo_selector',
),
In ext_tables.php register the wizard.
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_geo_selector',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/Yourwizardname/'
);
Keep in mind this is deprecated since Typo3 7 and removed in Typo3 8.So you can use this method upto Typo3 7.For Typo3 8 do use the method specified by David below.

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