Imagine a multi-site TYPO3 installation. One of those sites uses an Extension (loads the extension's TypoScript) that modifies the config.tx_extbase.persistence.classes config for GeorgRinger\News\Domain\Model\News. Other sites also use News, but without including that Extension doing the modification.
The problem that you will run into is that the DataMaps are cached globally - so after clearing the cache it depends which site will be called first and its extbase persistence configuration will be cached, possibly breaking the functionality of the other sites.
To get around this problem I started to move DataMapper related TypoScript into a separate TypoScript file ExtbasePersistence.typoscript and load it globally in ext_localconf.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('myext', 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:myext/Configuration/TypoScript/ExtbasePersistence.typoscript">');
My question is: Why is this not best practise and done in every extension? Or what am I doing wrong that I seem to be the only one running into that problem?
Edit: From my point of view this would mean that also core extensions (such as extbase) MUST load their DataMapper related TypoScript globally.
Extbase does load this globally via https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/extbase/ext_typoscript_setup.typoscript
This file is auto loaded by TYPO3 on a global scope, this is also best practice, as far as I know.
Each Extension can add this file, see https://docs.typo3.org/typo3cms/CoreApiReference/ExtensionArchitecture/FilesAndLocations/Index.html#reserved-file-names
Related
I've implemented code that is responsible for creating TYPO3 pages based on the data from the external source - code based mostly on Extbase.
How should I implement page permissions for each page? What is the best approach in this case? Should I extend my domain model (let's say class Page) to handle fields that are responsible for the permissions (like perms_userid, perms_groupid, perms_user, perms_group, perms_everybody)?
For things like importing stuff from external sources I'd recommend to use the DataHandler instead of Extbase. Additionally Extbase does not provide a Page model by default which you need to implement first.
Take a look at the documentation for DataHandler and for the execution of your script use the commands.
Be aware to use the correct TYPO3 version of the documentations. My links lead to current master (main).
I am currently developing my own TYPO3 extension (in v 9.5.11) and I want to know where I have to reference the Html file that is supposed to open when you click on Admin Tools-->MyExtension in the TYPO3 sidebar.
This completely depends on how you integrated your extension; there are at least two (vanilla, Extbase) ways to make such modules. Where your template file (which is Fluid, not pure HTML) exists depends on the integration and your TypoScript configuration that defines template paths, but by default it would be in your extension, in the sub path Resources/Private/Templates/$controllerName where $controlerName is the name of the controller that renders your plugin.
Note that template paths for frontend and backend are configured separately.
If you use the vanilla way of making backend modules you most likely need to define this template manually, by setting it in the view, in which case it can be placed anywhere you like (but should of course be inside your extension).
Have a look at system extension extensionmanager, where the backend module has some registered controller classes, and methods in ext_tables.php. fx class ListController, with indexAction, unresolvedDependenciesAction, terAction, ... and more methods:
'List' => 'index,unresolvedDependencies,ter,showAllVersions,distributions',
ListController class like all other controller classes uses FLUID views, which is looking for HTML templates inside Resources/Private/Templates/<CONTROLLERNAME>/...
For ListController->indexAction it would be Resources/Private/Templates/List/Index.html where you can use TYPO3 FLUID functionality.
See also https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/BackendModules/TemplateClass/Index.html
Well, It is always recommended to write your question clearly and bit more detail so people can understand quickly.
Anyway as I understand the question, you're talking about view resource file. If you have created your extension with Extension builder, your action file will automatically be generated in the Resource folder.
BE module directory will be Resources/Private/Backend See the example here.
In the TypoScript, you will get the source path this will something look like this.
To check the backend default action, you can see the backend module configuration here. From here you will get better idea which action will be call by default (Probably List action)
In this directory, you will have all the HTML you need. Hope this will help you!
I'm building several sites in a multisite TYPO3 v.8.7.1 installation and have created an extension for each site (site package) that includes the typoscript from the tx-news extension.
To rewrite the news extension url's I've added settings to the realurl.conf similar to the advanced example from the doc: https://docs.typo3.org/typo3cms/extensions/news/3.0.0/Main/Administration/Realurl/Index.html
Now, if possible I would like to migrate and sort the multisite realurl.conf settings to isolate each site's configuration in the respective site packages. Could I use the ext_localconf.php for this somehow?
And also I'm curious if it would be possible to set the fixedPostVars pageIds as TypoScript array variables in the setup or constants or the like to make these settings even more available for editing.
Thank you for your time!
We have such a solution using realurl (v2.1.0+) hooks:
https://bitbucket.org/reelworx/rx-typo3-sitesetup/src/e34b675a223f02580838fe7d5d118d7f07fd8a68/Classes/Hooks/RealUrl.php?at=master&fileviewer=file-view-default
and
https://bitbucket.org/reelworx/rx-typo3-sitesetup/src/e34b675a223f02580838fe7d5d118d7f07fd8a68/ext_localconf.php?at=master&fileviewer=file-view-default#ext_localconf.php-68
Thanks to Kleins answer and a lot of community support I've now managed to set up a solution that is working great.
First of all, when working with extension realurl rewriting, remember to delete realurl_autoconf.php and clear both typo3 and realurl cache during testing. Also check if realurl variables are applied in the typo3 Configuration Module
Solution 1, raw config
Just copy you config to ext_localconf.php
Solution 2, externalized config
This is more advanced and worked great for me. (Not sure if Kleins solution might be even better).
Create namespace class in Classes/RealUrlConf.php and include it in ext_localconf.php. Make sure to follow typo3's required conventions of filepath/namespace configuration.
Classes/RealUrlConf.php: https://pastebin.com/sg836BhJ
ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration']['coreRealUrlConf'] = 'Micke\\GenCore\\RealUrlConf->realUrlConfigurer';
If you want to use the setup just like this you can uncomment the definition and application of the pageIds in the Classes/RealUrlConf.php.
Solution 3, separate core config from site extensions
I have created a core package that is drawn as a dependency from the individual site packages in our installation. So in my case I'm settings only the configuration (without yet applying the pageIds) in the core, which is the config mentioned above. In this case without uncommenting anything.
For each individual sitepackage I then set up a similar configuration that just defines pageIds and applies the core configuration to them. In this was the pageIds are isolated in the individual site packages while most of the configuration resides in the core.
Classes/RealUrlConf.php: https://pastebin.com/A2xUvrJm
ext.localconf.php:
// Include realurl configuration with page IDs
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'][$_EXTKEY . 'realUrlVars'] = 'Micke\\RieSitepack\\RealUrlConf->realUrlConfigurer';
Good Luck!
Is there a possibility to change the typoscript template hierarchy via an extension-template? Currently i have defined everything including all typoscript in my extension. This works fine with real_url configuration etc. But everything regarding indexed_search is overwritten by the original extension itself.
Is there a possibility to define the loading/parsing order of extensions?
Thanks!
You need to define a dependency to all extensions that should load before your extension.
If you do not have a hard dependency, then make sure to list the extension as suggested, because this will make that it is loaded before your extension too.
Open the TypoScript record, switch to the tab "Includes", at the bottom you will find the field Static Template Files from TYPO3 Extensions:. Select the value Include before all static templates if root flag is set.
Question is a duplicate of Manage hierarchy / enforce priority of TS-templates
I have an TYPO3 installation with two domains. Each domain has its own provider extension and static template file.
Example:
domain1.com -> providerextension1
domain2.com -> providerextension2
Is it possible to hide the fluidcontent FCEs from providerextension1 in domain2.com?
Example from Bootstrappackage (https://github.com/Ecodev/bootstrap_package)
As soon as an extension has included fluidcontent FCEs (like the fluidcontent_bootstrap) it will add these to all domains, also when the TypoScript Configuration is not included.
If I understand the question completely, the answer is no: you cannot in TYPO3 make your TypoScript that is available in the backend, depend on the domain name being used. There is a way to make TypoScript conditions for the frontend output (for example a condition to only add template paths for your provider A when domain is X), but the same is not possible in the backend.
You are of course welcome to add a feature request on our issue tracker - I don't see any immediate problem with a feature to toggle on and off particular provider extensions based on for example a TypoScript setting. But you should keep in mind the limitation mentioned above since it implies that in order to achieve your desired goal you must place each domain record on a page tree of its own and closely manage the TypoScript that controls the available Provider Extensions on each page tree.
Put shortly: even if you get this feature request filled, it may not be the solution you want and you may have to restructure your pages and domains to get where you need to be.
The problem is, that the FCE are defined in the "ext_tables.php" and "ext_localconf.php" and these files are always loaded when the extension is enabled.
You can alter "ext_tables/ext_localconf" with a simple condition like
if($_SERVER['server_name'] == "www.yourdomain.com") {
//init FCEs here
}
You can try to override the template paths for one domain with an empty value or at least a path to an empty directory. Maybe flux is smart enough to ignore empty template paths.