Documentation on how to write a custom plugin for 8 ver.

Created on 2 January 2025, 19 days ago

Problem/Motivation

Documentation on how to write a custom plugin seems to be valid only for version 7. Using that documentation I've successfully written several custom plugins.
Writing a custom plugin for version 8 seems to be a totally different job and I'm totally lost. Adding some guidelines or links to specific documentation for version 8 would help a lot. Thanks.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @oppure
  • 🇳🇱Netherlands megachriz

    For the modern Drupal version, you no longer have Feeds Tamper plugins, but you have Tamper plugins instead. These plugins live in the Tamper project. Feeds Tamper is now a bridge between the Feeds and the Tamper module. There is no step to step guide for how to write your own Tamper plugin, but there are plugins in the Tamper project that could perhaps be used as an example.

    In short:

    • Tamper plugins are recommended to be in the namespace \Drupal\mymodule\Plugin\Tamper.
    • Each plugin extends
      \Drupal\tamper\TamperBase</code.</li>
      <li>If your Tamper plugin requires configuration, implement at least <code>defaultConfiguration()

      , buildConfigurationForm() and submitConfigurationForm() and add config schema for the plugin. Implement validateConfigurationForm() if needed.

    • Implement tamper() to apply the transformation. Return the transformed data.
    • If you like the plugin to be added to the Tamper module a Unit test that extends \Drupal\Tests\tamper\Unit\Plugin\Tamper\TamperPluginTestBase is required and a functional test that extends \Drupal\Tests\tamper\Functional\Plugin\Tamper\TamperPluginTestBase is required. (With both base classes you already get some test coverage for the plugin, such as if the methods return data of the correct type, if the form for adding a Tamper plugin instance can be submitted without errors and if config schema is correct.)

    Does this help? If not, feel free to reopen the issue.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024