Including New Integrations

This documentation will guide you through the process of adding new integrations to the TEC\<Plugin_Namespace>\Integrations system based on their Trait Type.


The Integrations system is built on an abstract class called Integration_Abstract from TEC\Common and a set of Traits representing different integration types:

  1. Theme_Integration: This type of integration focuses on compatibility and seamless interaction between a specific WordPress theme and the plugin or feature that is being integrated. It typically includes adjustments to the appearance, styling, and layout of the theme to ensure that the plugin’s features work smoothly within the theme’s structure.
  2. Server_Integration: Server integration involves making sure that the plugin is compatible with various server configurations and hosting environments. This may include handling different server settings, ensuring compatibility with different server software, and managing performance optimizations specific to certain hosting providers.
  3. Plugin_Integration: Plugin integration refers to the process of ensuring that the plugin being developed can work seamlessly alongside other plugins in the WordPress ecosystem. This might involve handling potential conflicts, ensuring interoperability, and providing hooks or filters for other plugin developers to extend or customize the functionality of the integrated plugin.
  4. Module_Integration: In this context, module integration refers to the integration of additional features or components within the main plugin or theme. These modules may be developed by the same team or by third-party developers and can extend the core functionality of the plugin or theme. Module integration involves creating an organized system that enables these modules to interact with the core functionality without causing conflicts or breaking the overall structure of the plugin or theme.

Each of these integration types helps ensure that the developed plugin or feature can work effectively in various scenarios and environments within the WordPress ecosystem, providing a smooth and seamless experience for users and developers alike.

Top ↑

Steps to Include New Integrations

Follow these steps to include a new integration based on its Trait Type:

  • Create a new PHP file for your integration in the appropriate folder according to the integration Trait Type:
    • For Theme_Integration, create a file under TEC/<Plugin_Namespace>/Integrations/Themes/
    • For Server_Integration, create a file under TEC/<Plugin_Namespace>/Integrations/Servers/
    • For Plugin_Integration, create a file under TEC/<Plugin_Namespace>/Integrations/Plugins/
    • For Module_Integration, create a file under TEC/<Plugin_Namespace>/Integrations/Modules/
  • In the new PHP file, define a new class that extends the Integration_Abstract from TEC\Common class and uses the appropriate Trait for the integration type.
   namespace TEC\<Plugin_Namespace>\Integrations\<Type>s;

   use TEC\Common\Integrations\Integration_Abstract;
   use TEC\Common\Integrations\Traits\<Trait_Type>;

   class Your_Integration extends Integration_Abstract {
       use <Trait_Type>;

       // Your implementation details go here
  • Implement the required abstract methods in your new class:
    • get_slug(): This method should return a unique string identifier for your integration.
    • load_conditionals(): This method should return a boolean value, determining whether the integration should be loaded based on specific conditions.
    • load(): This method should include the actual loading process for your integration.
  • Register the new integration class in the main service provider of your plugin or theme.

That’s it! Your new integration is now part of the TEC\<Plugin_Namespace>\Integrations system and will be loaded based on its Trait Type and the specified conditions.