Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Deprecate plugin content element and plugin subtypes (list_type) #4821

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

linawolf
Copy link
Member

@linawolf linawolf self-assigned this Oct 13, 2024
@linawolf linawolf marked this pull request as draft October 13, 2024 08:57
@linawolf linawolf force-pushed the task/codesnippets2 branch 2 times, most recently from 345a537 to 9ae84d1 Compare October 14, 2024 13:41
@linawolf linawolf marked this pull request as ready for review October 14, 2024 13:42
@linawolf linawolf marked this pull request as draft October 14, 2024 13:43
@linawolf linawolf added the backport 13.4 Backport to TYPO3v13 label Oct 15, 2024
@linawolf linawolf force-pushed the task/codesnippets2 branch 2 times, most recently from 7e2a4ca to 8e5da43 Compare October 16, 2024 19:18
@linawolf linawolf marked this pull request as ready for review October 16, 2024 19:18
subtype.
.. deprecated:: 13.4
Using the default `list_type` for the parameter is deprecated. All content
elements and plugins should be added as sing `CType` for parameter `$type`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sing? La la lala la laaaa string? single?

Each plugin has its own plugin type, which is used in the database field
tt_content.list_type. The list_type could be understood as subtype of CType.
.. deprecated:: 13.4
Setting the second parameter to any value but `CType`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only list_type is deprecated. You still can call that method without any deprecations for any TCA select type. Sure, it does not make sense, but it's possible. addPlugin looks a little bit like addTcaSelectItem, it just adds a new entry to a select type.


.. _plugins-list-type-migration-extbase-configuration:

1. Adjust the Extbase plugin configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the fourth parameter, `$nonCacheableControllerActions` was missing you can
set it to an empty array, the default value.

It is theoretically possible that the extension author did not use this utility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct for Extensions without Extbase usage, but for Extbase it is needed to register the action and controller here:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins']. And that entry will only be done by configurePlugin. But yes, you also can register that part manually, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and I have seen ppl do that. You cannot rely on they used the Utility functions. But "theoretically"

:caption: EXT:examples/Configuration/TCA/Overrides/tt_content.php (difference)

The `CType` based plugin does not inherit the standard fields provided by the
TCA of the content-element "List". These where in many cases removed by
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly everywhere above you write it without -

Suggested change
TCA of the content-element "List". These where in many cases removed by
TCA of the content element "List". These where in many cases removed by

-------------------------------------------------------------

.. literalinclude:: _Migration/_tca_registration.php.diff
:caption: EXT:examples/Configuration/TCA/Overrides/tt_content.php (difference)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are writing Line 15 below. So activating line numbers would be perfect

Suggested change
:caption: EXT:examples/Configuration/TCA/Overrides/tt_content.php (difference)
:caption: EXT:examples/Configuration/TCA/Overrides/tt_content.php (difference)
:linenos:


As these fields are not displayed automatically anymore you can remove this
definition without replacement: Line 15 in the diff. If they have not been
removed and still needed you need to add them manually to your plugins type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
removed and still needed you need to add them manually to your plugins type.
removed and are still needed, you will need to manually add them to your plugin type.

Comment on lines +114 to +120
Migration example: Core-based plugin
====================================

.. _plugins-list-type-migration-core-registration:

1. Adjust the plugin registration
==================================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, not rendered until now. No link, no content, ... look ugly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like something is missing...

Comment on lines 4 to 12
ExtensionUtility::configurePlugin(
'Examples',
'FalExamples',
'HtmlParser',
[
HtmlParserController::class => 'index',
],
+ [],
+ ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is completely broken here. 3rd Argument is an Array, but here it is "HtmlParser" and the indents of 6th (should be 5th) argument is missing 3 spaces. And in general the indents in PHP are 4 and not 7.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a diff, not a PHP file?

'tt_content',
'--div--;Configuration,pi_flexform,',
$pluginSignature,
'after:subheader',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subheader is only available for CType header. As subheader is not available for all other CTypes this field will be added to the last tab and behind last field.

'tt_content',
'--div--;Configuration,pi_flexform,',
$pluginSignature,
'after:subheader',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works only for CType "header" as expected

#. A unique identifier for your plugin in UpperCamelCase: :php:`'PostSingle'`
#. An array of allowed combinations of controllers and actions stored in an array
#. (Optional) an array of controller name and action names which should not be cached
#. Using any value but `ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT` is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only list_type will create a deprecation log entry

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the default value which is empty but defaults to list_type as well. So for all practical reasons: just use ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT. I don't think details beyond this are needed

If the fourth parameter, `$nonCacheableControllerActions` was missing you can
set it to an empty array, the default value.

It is theoretically possible that the extension author did not use this utility
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and I have seen ppl do that. You cannot rely on they used the Utility functions. But "theoretically"

Comment on lines 4 to 12
ExtensionUtility::configurePlugin(
'Examples',
'FalExamples',
'HtmlParser',
[
HtmlParserController::class => 'index',
],
+ [],
+ ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a diff, not a PHP file?

#. A unique identifier for your plugin in UpperCamelCase: :php:`'PostSingle'`
#. An array of allowed combinations of controllers and actions stored in an array
#. (Optional) an array of controller name and action names which should not be cached
#. Using any value but `ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT` is
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the default value which is empty but defaults to list_type as well. So for all practical reasons: just use ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT. I don't think details beyond this are needed

linawolf and others added 2 commits October 17, 2024 14:36
Co-authored-by: Stefan Frömken <123929835+sfroemkenjw@users.noreply.github.com>
Co-authored-by: Stefan Frömken <123929835+sfroemkenjw@users.noreply.github.com>
'tt_content',
'--div--;Configuration,pi_flexform,',
$pluginSignature,
'after:subheader',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'after:subheader',
'after:header',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 13.4 Backport to TYPO3v13
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Deprecate plugin content element and plugin subtypes (list_type)
2 participants