Introduction
The Akeneo PIM (Product Info Administration) system supplies a customizable and extensible platform for managing product information. One of many customization choices accessible is the flexibility so as to add a brand new tab to the Akeneo aspect menubar. On this weblog submit, we’ll stroll you thru the steps to create a brand new tab and combine it seamlessly into the Akeneo interface.
Conditions
Earlier than we start, ensure you have the next stipulations:
- Entry to the Akeneo undertaking listing
- Familiarity with PHP and Symfony framework
- Fundamental understanding of Akeneo’s structure
Step 1: Create a New Bundle
To start out, we have to create a brand new bundle for our customized performance. Observe these steps:
- Find the Akeneo undertaking listing in your server.
- Open a terminal and navigate to the `
src
` listing inside your Akeneo undertaking. - Create a brand new listing in your customized bundle. Let’s identify it `
CustomBundle
`. - Contained in the `
CustomBundle
` listing, create the mandatory recordsdata and folders in line with Symfony’s bundle construction.
Right here’s an instance of the listing construction in your customized bundle:
src/ CustomBundle/ Controller/ CustomController.php Sources/ views/ index.html.twig CustomBundle.php
Step 2: Configure the Bundle
Subsequent, we have to configure the newly created bundle. Right here’s what you should do:
- Open the `
CustomBundle.php` file positioned contained in the `CustomBundle
` listing. - Outline the namespace and prolong the `
Bundle
` class. - Implement the mandatory strategies required by the `
Bundle
` class.
Right here’s an instance of the CustomBundle.php
file:
// src/CustomBundle/CustomBundle.php namespace CustomBundle; use SymfonyComponentHttpKernelBundleBundle; class CustomBundle extends Bundle { }
Step 3: Create the Controller
On this step, we’ll create a controller that may deal with the logic for the brand new tab. Observe these steps:
- Contained in the
Controller
listing of yourCustomBundle
, create a brand new file, e.g.,CustomController.php
. - Outline the namespace and prolong the
AbstractController
class from Symfony. - Implement the motion methodology that will probably be chargeable for rendering the content material of your new tab.
Right here’s an instance of the CustomController.php
file:
// src/CustomBundle/Controller/CustomController.php namespace CustomBundleController; use SymfonyBundleFrameworkBundleControllerAbstractController; use SymfonyComponentHttpFoundationResponse; class CustomController extends AbstractController { public perform index(): Response { return $this->render('@Customized/views/index.html.twig'); } }
Step 4: Create the Template
To show the content material of the brand new tab, we’ll create a template file. Observe these steps:
- Contained in the
Sources
listing of yourCustomBundle
, create a brand new listing namedviews
. - Contained in the
views
listing, create a brand new file, e.g.,index.html.twig
. - Outline the mandatory HTML construction and content material in your new tab utilizing Twig syntax.
Right here’s an instance of the index.html.twig
file:
{# src/CustomBundle/Sources/views/index.html.twig #} {% extends '@Akeneo/structure.html.twig' %} {% block content material %} <h1>New Tab</h1> <p>That is the content material of the brand new tab.</p> <code>//
Step 5: Clear the Cache
To make sure that your adjustments take impact, we have to clear the cache. Run the next command within the terminal:
php bin/console cache:clear
Now you may see Akeneo aspect menubar within the above picture.
Introduction
The Akeneo PIM (Product Info Administration) system supplies a customizable and extensible platform for managing product information. One of many customization choices accessible is the flexibility so as to add a brand new tab to the Akeneo aspect menubar. On this weblog submit, we’ll stroll you thru the steps to create a brand new tab and combine it seamlessly into the Akeneo interface.
Conditions
Earlier than we start, ensure you have the next stipulations:
- Entry to the Akeneo undertaking listing
- Familiarity with PHP and Symfony framework
- Fundamental understanding of Akeneo’s structure
Step 1: Create a New Bundle
To start out, we have to create a brand new bundle for our customized performance. Observe these steps:
- Find the Akeneo undertaking listing in your server.
- Open a terminal and navigate to the `
src
` listing inside your Akeneo undertaking. - Create a brand new listing in your customized bundle. Let’s identify it `
CustomBundle
`. - Contained in the `
CustomBundle
` listing, create the mandatory recordsdata and folders in line with Symfony’s bundle construction.
Right here’s an instance of the listing construction in your customized bundle:
src/ CustomBundle/ Controller/ CustomController.php Sources/ views/ index.html.twig CustomBundle.php
Step 2: Configure the Bundle
Subsequent, we have to configure the newly created bundle. Right here’s what you should do:
- Open the `
CustomBundle.php` file positioned contained in the `CustomBundle
` listing. - Outline the namespace and prolong the `
Bundle
` class. - Implement the mandatory strategies required by the `
Bundle
` class.
Right here’s an instance of the CustomBundle.php
file:
// src/CustomBundle/CustomBundle.php namespace CustomBundle; use SymfonyComponentHttpKernelBundleBundle; class CustomBundle extends Bundle { }
Step 3: Create the Controller
On this step, we’ll create a controller that may deal with the logic for the brand new tab. Observe these steps:
- Contained in the
Controller
listing of yourCustomBundle
, create a brand new file, e.g.,CustomController.php
. - Outline the namespace and prolong the
AbstractController
class from Symfony. - Implement the motion methodology that will probably be chargeable for rendering the content material of your new tab.
Right here’s an instance of the CustomController.php
file:
// src/CustomBundle/Controller/CustomController.php namespace CustomBundleController; use SymfonyBundleFrameworkBundleControllerAbstractController; use SymfonyComponentHttpFoundationResponse; class CustomController extends AbstractController { public perform index(): Response { return $this->render('@Customized/views/index.html.twig'); } }
Step 4: Create the Template
To show the content material of the brand new tab, we’ll create a template file. Observe these steps:
- Contained in the
Sources
listing of yourCustomBundle
, create a brand new listing namedviews
. - Contained in the
views
listing, create a brand new file, e.g.,index.html.twig
. - Outline the mandatory HTML construction and content material in your new tab utilizing Twig syntax.
Right here’s an instance of the index.html.twig
file:
{# src/CustomBundle/Sources/views/index.html.twig #} {% extends '@Akeneo/structure.html.twig' %} {% block content material %} <h1>New Tab</h1> <p>That is the content material of the brand new tab.</p> <code>//
Step 5: Clear the Cache
To make sure that your adjustments take impact, we have to clear the cache. Run the next command within the terminal:
php bin/console cache:clear
Now you may see Akeneo aspect menubar within the above picture.