flux
flux copied to clipboard
Call to a member function setOption() on null - when updating to 9.4.2
Hello!
When updating from 9.4.1 to 9.4.2 the following error occured (Call to a member function setOption() on null):
As you can see in the error, the cause is my Video.html Flux element. Until now everything worked fine. This is my Configuration section of Video.html:
<f:section name="Configuration">
<f:if condition="{v:variable.typoscript(path: 'plugin.tx_providerpackage.config.content.video')}">
<flux:form id="video">
<flux:form.option.group value="fce" />
Some <flux:field> here...
</flux:form>
</f:if>
</f:section>
The if-condition causes the error here, but only if the condition is false and thus the content not rendered (The element is "deactivated"). Same if I delete the if condition with content. If the condition is true everything works fine. Before the update this gave no error, the element was just not visible/selectable in the content element wizard. I need to be able to activate/deactivate the element depending on the situation and layout. I can't just delete it, because it lays in providerpackage, a kind of a library, which is extended by one of many layoutpackages which need to disable elements.
Is there another solution or is it just not possible anymore? It is quite overwhelming for a user/editor to suddenly see so many elements or when some elements are simply not supported for the current layout.
You can toggle availability of individual content types / page templates in the "Site" module, there's a tab dedicated to Flux-based assets. If you are on 8.7 you can use pageTSconfig to remove individual types from the new content wizard, the CType selector, etc. A Flux-based asset must always return a Form instance or it is considered invalid.
I am on Typo3 10. Ok you mean the "Flux Providers"-Tab -> Available content types (empty selection means allow-all)[flux_content_types]? This is completely empty. "Available page layouts/templates (empty selection means allow-all)[flux_page_templates]" is filled with the page layouts. I could handle it with user-rights, too. But we handle everything currently with layoutpackages and constants (plugin.tx_providerpackage.config.content.video = 0 in e.g. layoutpackagex), and it would be quite an effort to change it manually for every site.. I have to look if I can solve this with pageTS CType removeItems. Thank you for the hints.
If you have this sort of condition around all your flux:form tags that could explain why you don't see any options in this selector. Editing sites has no TS page context so all of these conditions would be false, causing no form to be returned.
The same error occures when I delete a page of type "shortcut" in the pagetree (shortcut target is an internal page). flux 9.4.2 TYPO3 9.5.22
Log:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: Call to a member function setOption() on null | Error thrown in file /PATH/TO/TYPO3/typo3conf/ext/flux/Classes/Provider/AbstractProvider.php in line 284.
Error seems for me also to appear in Flux 9.4.2 after renaming a template which already had been selected. On such pages with the now renamed Template the exception "setOption on null" appears. This is is not reasonable! Neither an admin nor a normal user can fix this as the page becomes inaccessible in backend!
Flux 9.4.1 is able to handle this and shows an error like this:
Tried resolving a template file for controller action "Page->FooBar" in format ".html", but none of the paths contained the expected template file ().
I'm having the same issue on another companies Installation that I'm supposed to update. I am unfortunately completely new to Flux. Currently running are TYPO3 9.5.24, Flux 9.4.2 and I get the same error. The lists in the Sie Configuration are empty for me, too, and I don't understand what the alternative approach is. Can you elaborate a bit more, @NamelessCoder ? Thanks for the afford in advange.
I got the same error message Call to a member function setOption() on null in the TYPO3 backend page module while updating to TYPO3 10.4 with Flux 9.4.2. I was able to solve it by setting the fields tx_fed_page_controller_action
and tx_fed_page_controller_action_sub
of the root page to an empty string.
I was able to fix this error by removing EXT:fluidpages, which I had left over from before upgrading to EXT:flux-only.
I have the exact same error message, when trying to click on the „More …“ link in a powermail form content element (should route me to the sys folder containing the emails for that form).
Setting the tx_fed_page_controller_action
and tx_fed_page_controller_action_sub
for the sys folder removes the error message, but breaks the powermail routing, just shows the sys folder in Page module.
- Flux 9.4.2
- TYPO3 9.5.24 (Mittwald)
- Installed the "flux" extension
- Completed
update pages SET tx_fed_page_flexform = '', tx_fed_page_flexform_sub = '', tx_fed_page_controller_action = '', tx_fed_page_controller_action_sub = '', backend_layout = '', backend_layout_next_level = '';
-
Created a page (id = 254)
-
Manually added update pages SET tx_fed_page_controller_action = 'Foo.Foo' where uid = 254;
-
Got an error: "Call to a member function setOption () on null"
Doing the same for the content element (ContentProvider) - I did not receive an error but received a SELECT field where I can select another content element.
I suppose you need to correct the provider for pages and subpages so that you do not receive a critical error and be able to change the Layout pages through the form as well as for the content element.
This is very important when you remove some of the extensions - for example ...
Flux - Very cool extension (even cooler than TV-varibles Modx). For a long time I couldn’t figure it out. I'm very glad I was able to go further than simple "gridelements". By the way, when I first went to https://fluidtypo3.org/, it was around 2014, and whenever I came in, I didn't understand that you could watch the video by clicking on the green button)))). If the video was without a button - maybe it would be easier for me to figure it out.)
Regarding providers - I was able to register providers for tt_content with my keys (FrontendContentElement, FrontendContentGridelement) without any problems, incl. plugin (FrontendContentPlugin). But with pages "pages" it is not possible to register my provider with my key (FrontendPage).
What I would really like:
- Be able to register a provider for the pages.
- flux_capitator is a very hot topic for searching and filtering data! I guess from this you can make a simplified EAV (entity attribute value)
- I would very much like to have columns in the extension tx_gridelements_container int (11) DEFAULT '0' NOT NULL, tx_gridelements_columns int (11) DEFAULT '0' NOT NULL, instead of adding "uid01, uid02" .... I suppose it was like this in older versions ...
- I don't quite understand why you need to install "backend_layout" = 'flux___grid'?
switch($class::$TYPO3['thisIs']){
case 'FrontendPage':
/*
\FluidTYPO3\Flux\Core::registerFluidFlexFormContentObject(
$namespace_ex[0].'.'.$namespace_ex[1],
$signature,
'EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Elements/'.$nameclass.'/Default.html',
[],
'Configuration',
# array(
# 'layoutRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Layouts/',
# 'partialRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Partials/',
# 'templateRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Templates/',
# )
);
*/
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
/** @var $objectManager ObjectManagerInterface */
/** @var $provider ProviderInterface */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$provider = $objectManager->get(PagesProvider::class);
$provider->setTableName('pages');
$provider->setFieldName('tx_fed_page_flexform');
$provider->setExtensionKey($namespace_ex[0].'.'.$namespace_ex[1]); // .'.'.$nameclassWithoutControllerPostfix
$provider->setTemplatePathAndFilename('EXT:'.$extensionKey.'/Resources/Private/Templates/Pages/'.$nameclassWithoutControllerPostfix.'/Index.html');
$provider->setTemplateVariables([]);
$provider->setTemplatePaths(null);
$provider->setConfigurationSectionName('Configuration');
$provider->setControllerName('Pages/'.$nameclassWithoutControllerPostfix);
$provider->setControllerAction('index');
$provider->setPageObjectType($signature);
\FluidTYPO3\Flux\Core::registerConfigurationProvider($provider);
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
// ?????????????????????????????????????
/** @var $objectManager ObjectManagerInterface */
/** @var $provider ProviderInterface */
/*
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$provider = $objectManager->get(PagesSubProvider::class);
$provider->setTableName('pages');
$provider->setFieldName('tx_fed_page_flexform_sub');
$provider->setExtensionKey($namespace_ex[0].'.'.$namespace_ex[1]); // .'.'.$nameclassWithoutControllerPostfix
$provider->setTemplatePathAndFilename('EXT:'.$extensionKey.'/Resources/Private/Templates/Pages/'.$nameclassWithoutControllerPostfix.'/Index.html');
$provider->setTemplateVariables([]);
$provider->setTemplatePaths(null);
$provider->setConfigurationSectionName('Configuration');
$provider->setControllerName('Pages/'.$nameclassWithoutControllerPostfix);
$provider->setControllerAction('index');
$provider->setPageObjectType($signature);
\FluidTYPO3\Flux\Core::registerConfigurationProvider($provider);
*/
break;
case 'FrontendContentElement':
/*
\FluidTYPO3\Flux\Core::registerFluidFlexFormContentObject(
$namespace_ex[0].'.'.$namespace_ex[1],
$signature,
'EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Elements/'.$nameclass.'/Default.html',
[],
'Configuration',
# array(
# 'layoutRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Layouts/',
# 'partialRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Partials/',
# 'templateRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Templates/',
# )
);
*/
/** @var $objectManager ObjectManagerInterface */
/** @var $provider ProviderInterface */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$provider = $objectManager->get(TtContentProvider::class);
$provider->setTableName('tt_content');
$provider->setFieldName('pi_flexform');
$provider->setExtensionKey($namespace_ex[0].'.'.$namespace_ex[1]);
$provider->setTemplatePathAndFilename('EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Elements/'.$nameclassWithoutControllerPostfix.'/Index.html');
$provider->setTemplateVariables([]);
$provider->setTemplatePaths(null);
$provider->setConfigurationSectionName('Configuration');
$provider->setContentObjectType($signature);
\FluidTYPO3\Flux\Core::registerConfigurationProvider($provider);
break;
case 'FrontendContentGridelement':
/*
\FluidTYPO3\Flux\Core::registerFluidFlexFormContentObject(
$namespace_ex[0].'.'.$namespace_ex[1],
$signature,
'EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Gridelements/'.$nameclass.'/Index.html',
[],
'Configuration',
# array(
# 'layoutRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Layouts/',
# 'partialRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Partials/',
# 'templateRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Templates/',
# )
);
*/
/** @var $objectManager ObjectManagerInterface */
/** @var $provider ProviderInterface */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$provider = $objectManager->get(TtContentProvider::class);
$provider->setTableName('tt_content');
$provider->setFieldName('pi_flexform');
$provider->setExtensionKey($namespace_ex[0].'.'.$namespace_ex[1]);
$provider->setTemplatePathAndFilename('EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Gridelements/'.$nameclassWithoutControllerPostfix.'/Index.html');
$provider->setTemplateVariables([]);
$provider->setTemplatePaths(null);
$provider->setConfigurationSectionName('Configuration');
$provider->setContentObjectType($signature);
\FluidTYPO3\Flux\Core::registerConfigurationProvider($provider);
break;
case 'FrontendContentPlugin':
/*
\FluidTYPO3\Flux\Core::registerFluidFlexFormPlugin(
$namespace_ex[0].'.'.$namespace_ex[1],
$signature,
'EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Plugins/'.$nameclass.'/Default.html',
[],
'Configuration',
# array(
# 'layoutRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Layouts/',
# 'partialRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Partials/',
# 'templateRootPath' => 'EXT:'.$extensionKey.'/Resources/Private/Templates/',
# )
);
*/
/** @var $objectManager ObjectManagerInterface */
/** @var $provider ProviderInterface */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$provider = $objectManager->get(TtContentProvider::class);
$provider->setTableName('tt_content');
$provider->setFieldName('pi_flexform');
$provider->setExtensionKey($namespace_ex[0].'.'.$namespace_ex[1]);
$provider->setTemplatePathAndFilename('EXT:'.$extensionKey.'/Resources/Private/Templates/PagesElements/Plugins/'.$nameclassWithoutControllerPostfix.'/Index.html');
$provider->setTemplateVariables([]);
$provider->setTemplatePaths(null);
$provider->setConfigurationSectionName('Configuration');
$provider->setListType($signature);
\FluidTYPO3\Flux\Core::registerConfigurationProvider($provider);
break;
}
The problem described in the issue has been fixed for a while. In cases where Flux is - for whatever reason except for fatal errors - unable to retrieve a form definition from the template or provider, Flux will default to an empty form instance. This avoids the breakage but of course still leaves your template inoperable in cases such as the one described in https://github.com/FluidTYPO3/flux/issues/1832#issuecomment-700047963.
@iv-litovchenko Sorry I'm so late with this reply, I didn't see it until now. Page features are now integrated in Flux directly - you can use them with Provider instances like you do with content, but it's a bit more challenging to actually make this work (due to the nature of pages, page translations, inheritance and TYPO3's page rendering in general). Flux provides a set of base classes, the PageProvider and it's accompanying Providers - I'd suggest you use those rather than attempting to make the generic Provider work for that use case.
To answer your questions:
- This is now natively supported
- The feature set of
flux_capacitor
is integrated (though not in the exact same way, it does have the same feature set). It can be enabled by toggling the "EXPERIMENTAL - FlexForm-to-IRRE" option in Flux extension configuration. Be careful though, it replaces the storage method in all elements and probably should only be used on fresh projects. - Parent/child columns are expressed as virtual colPos values instead of separate DB columns. Anything that you could do in terms of selecting content or resolving parent UIDs is possible but requires calculation, e.g. parent UID of a nested content element is
floor(colPos / 100)
, local column number iscolPos % 100
and selecting child content of a certain parent+column isWHERE colPos = (parent.uid * 100) + localColumnNumber
. Take a look at\FluidTYPO3\Flux\ViewHelpers\Content\GetViewHelper::getContentRecords
for a quick example. - Selecting a backend layout is necessary only for BE operation and only in case your page template defines columns. If you prefer to stick with TS or backend_layout record defined page columns it is not necessary to select the backend layout generated by Flux. But, if you want to use page columns from a Flux template you do have to tell TYPO3 that "my columns are located in the virtual backend layout generated by Flux" and this is done by selecting this particular value in the two backend layout fields in page properties. There is no way to forcibly override this (and even if there were, it wouldn't be friendly to do so as it would prevent every other method of defining page columns).