TYPO3: Add attribute to RTE table - typo3

I have previously used this TypoScript snippet in my setup to add a class to a table.
lib.parseFunc_RTE {
externalBlocks {
table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
default = table table-hover
always = 1
list >
}
}
}
This worked perfectly in TYPO3 6.x, but does not do anything in version 4.5. Is there any other method to do this?
While at it, I'd also like to add data-* to the table headers.

Related

Shopware 6: sw-inherit-wrapper property currentValue does not update on select

I've a custom entity enterprise, which is assigned to product.extensions.myPlugin.enterpriseId.
Now i want to select the enterprise within Shopware Vue-Component sw-entity-single-select wrapped by sw-inherit-wrapper:
<sw-inherit-wrapper
v-model="product.extensions.myPlugin.enterpriseId"
:has-parent="false"
:inherited-value="null">
<template #content="{currentValue, updateCurrentValue, isInherited}">
<sw-entity-single-select
class="enterprise-name"
:key="isInherited"
:value="currentValue"
entity="enterprise"
:placeholder="$tc('inputEnterprise.placeholder')"
show-clearable-button
allow-entity-creation
:entity-creation-label="$tc('inputEnterprise.labelCreation')"
#change="updateCurrentValue"></sw-entity-single-select>
</template>
</sw-inherit-wrapper>
This template ist part of a modal.
On select a enterprise from given list, the <sw-entity-single-select__selection-text> does not update.
Step out step in into the template (close and reopen the parent modal), the enterprise is set and printed out on the <sw-entity-single-select__selection-text>.
So the entity extension was updated but not the property currentValue in <sw-entity-single-select__selection-text>
As example i follow the sw_product_basic_form_manufacturer_field
Question: Why property currentValue does not update in <sw-entity-single-select> on select from its list?
EDIT #1
The extension is set in overridden component sw-product-detail like this:
// sw-product-detail/index.js
...
Component.override('sw-product-detail', {
...
computed: {
myPluginRepository() {
return this.repositoryFactory.create('my_plugin');
},
}
watch: {
product() {
if(this.product.id) {
this.__setMyPluginExtension()
}
}
},
methods: {
...
__setMyPluginExtension() {
let extension = this.product.extensions.myPlugin ?? null;
if(null === extension) {
extension =
this.myPluginRepository.create(Shopware.Context.api);
extension.enterpriseId = null
}
this.product.extensions.myPlugin = extension;
},
}
}
Inside the overridden child component sw-product-detail-base the modal is loaded.
I think, the extension is known when the component is loaded and rendered. I've check it with a debug breakpoint inside the created() in the custom component, the extension is known like defined in parent component.
Even more, if i set extension.enterpriseId a real default value instead null then the enterprise is printed out in <sw-entity-single-select__selection-text>, what me indicate, the extension is known.
Btw, i used the change method, but i'm looking for my error...
Best guess without knowing more of the stack would be that this.product.extensions.myPlugin.enterpriseId isn't reactive. That would be the case if the property doesn't exists when the product is originally set and it is declared like this:
this.product.extensions.myPlugin = {
enterpriseId: 'asdf'
};
Any further changes to enterpriseId would then not be reactive and the view would subsequently not be updated when it changes.
To be safe you could add a #change listener to sw-inherit-wrapper and update the property reactively:
onEnterpriseIdChange(enterpriseId) {
if (!this.product.extensions.myPlugin) {
this.$set(this.product.extensions, 'myPlugin', {});
}
if (!this.product.extensions.myPlugin.enterpriseId) {
this.$set(this.product.extensions.myPlugin, 'enterpriseId', enterpriseId);
}
}
As addition of #dneustadt answers:
...
const extension = this.myPluginRepository.create(Shopware.Context.api);
extension.enterpriseId= null
this.$set(this.product.extensions, 'myPlugin', extension)
...
Use the repository create() method instead create a simple object because of required method entity.getEntityName() in changeset-generator.data.js

TYPO3 v11 persistence.storagePid is ignored

I have an TYPO3 Extbase extension with TYPO3 11.
My problem is, that every item is shown.
In my plugin there is a Flexform Field for the storagePid. But the plugin completely ignored this settings and every time lists all items.
How can I tell my extension that it should only load items from the selected page?
I have tried to set this:
public function getItems()
{
$table = 'TABLE';
$query = $this->itemRepository->createQuery();
$query->getQuerySettings()->setRespectStoragePage(true);
return $query->execute();
}
But that doesn't help.
This doesn't change anything in the repository
public function initializeObject() {
/** #var Typo3QuerySettings $querySettings */
$querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(TRUE);
$this->setDefaultQuerySettings($querySettings);
}
I am assuming you mean what you set in the default field tt_content.pages and tt_content.recursive.
Here is an example how to get the page IDs from the fields: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/felogin/Classes/Controller/AbstractLoginFormController.php#L35-L50
And then you would set that for your Extbase query:
$querySettings = $this->myRepository->createQuery()->getQuerySettings();
$querySettings->setStoragePageIds(...);
Background:
Here is a great write-up how naming a Flexform field persistence.storagePid would give you that, too https://www.derhansen.de/2016/02/how-extbase-determines-storagepid.html

How to manipulate ts configuration into a brand new extension in TYPO3 7.6

I follow the official guide to create a new extension on TYPO3 7.6 based on an old extension that need configuration static and configuration in template but in controller, I can't get the config.
$this->settings
return an empty array
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][strtolower($this->extensionName)]
return an empty array
$TYPO3_LOADED_EXT[strtolower($this->extensionName)]
return an empty array
does somebody know how to manipulate configuration in TYPO3 7.6?
Thanks for any help
Your custome extension setup.ts and constant.ts like this.
setup.ts
plugin.tx_yourextension_key {
settings {
enableWebsiteField = {$plugin.tx_extension_key.settings.enableWebsiteField}
}
constant.ts
plugin.tx_yourextension_key {
settings {
enableWebsiteField = 1
}
You can get value in controller.php file like this.
$this->settings['enableWebsiteField']

Typo3 Neos: How to insert a form into a template

Is it possible to insert a form build with TYPO3.Form into a template? I defined all needed fields in the .yaml file and would like to render this directly in the template and not insert it via the backend.
I'm not quite sure if i understand you correctly, but in your Typoscript configuration you can specifiy nodetypes which will be rendered on the page. I needed to render a form in a footer on all sites, here's my working configuration:
Root.ts2
footerData {
form = TYPO3.Neos.NodeTypes:Form {
formIdentifier = "minimal-contact-form"
}
}
Default.html
...
{footerData.form -> f:format.raw()}
...
minimal-contact-form.yaml
type: 'TYPO3.Form:Form'
identifier: minimal-contact-form
label: 'Minimal Contact form'
...

Inheritance of TYPO3 models

I have a tricky question about the inheritance of TYPO3 models:
I want to extend the extension powermail with two seperate/independed (!) extensions. The first extend powermail TCA-forms and needs the new fields in the fluid template. The second extends also the TCA-forms, but not need an output in the frontend.
Now I use the mixed-ins hack from Franz Koch http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-September/006497.html which using the delete field as record type. But this solution works only for one extension. According to the loading of the TS persistence settings either the first or the second model of the extension will be loaded.
If I use an own field for the record type – eg. for the field record of powermail – I can use only one record type for the one extension, but can't access to the other.
Is there a way to "merge" ALL models related to the base model?
Next current TS config:
config.tx_extbase {
persistence {
classes {
# Using mixed-ins hack from Franz Koch to make map table extendable.
# #see http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-September/006497.html
Tx_Powermail_Domain_Model_Fields {
mapping.recordType = 0
subclasses.0 = Vendor\MyExtension\Domain\Model\Powermail\Fields
}
Vendor\MyExtension\Domain\Model\Powermail\Fields {
mapping {
tableName = tx_powermail_domain_model_fields
recordType = 0
columns {
tx_myfirstextension_field_one.mapOnProperty = FieldOne
}
}
}
}
}
}
ext_tables.php:
// Using mixed-ins hack from Franz Koch to make map table extendable.
// #see http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2010-September/006497.html
$TCA['tx_powermail_domain_model_forms']['ctrl']['type'] = 'deleted';
$TCA['tx_powermail_domain_model_pages']['ctrl']['type'] = 'deleted';
$TCA['tx_powermail_domain_model_fields']['ctrl']['type'] = 'deleted';