Links

Reusable components library (Pro)

About the feature

Reuse is a fundamental aspect that enables developers to create advanced functionalities without investing excessive time in implementation.
In the Pro version, you can reuse Views and Cards that you've crafted for one website on multiple others. You have the capability to preserve any item in your personal Git library, expediting the development process for future websites.

How it works

Reusing necessitates an independent storage space (library) distinct from any specific project, along with a manager capable of pulling and pushing items to this library.
Within Advanced Views, any GitLab repository can function as a component library, and the Advanced Views UI facilitates pulling and pushing Views and Cards into this library.
Additionally, you have the option to include related Meta groups with the component, prompting Advanced Views to automatically create all associated Meta groups during the pull process.
We've opted for Git due to its robustness and widespread use as a version control tool, with GitLab repositories being entirely free.
You can interact with the library solely through the plugin's UI or alternatively, make modifications using the git terminal and GitLab UI.
The libraries you construct are entirely yours, ensuring you maintain full control over them even after your Pro license has expired.
Note: The Git library is project-independent, allowing you to continue using Git for managing specific projects, as Advanced Views refrains from creating any '.git' folder and utilizes Rest API for pulling and pushing items to the library.

How to create a Git library

  1. 1.
    Create a GitLab account (free).
  2. 2.
    Establish a new private repository (free).
  3. 3.
    Navigate to the 'Git repositories' tab in the plugin settings and follow the provided instructions to add the new repository.

How to add (push) items

Once you've added a Git repository in the settings, you can 'push' any View or Card to the repository. Simply open the desired View or Card, select the added repository from the 'GitLab repositories' meta box (located in the right panel), and click the 'Push' button.
If you select the 'Include related Meta groups' checkbox, the component will also store data related to associated Meta Groups (such as ACF Group) and automatically import them during 'pulling'.
Note: When you 'push' a View or Card, all related Views will be included automatically. Therefore, pushing a Card will also push the corresponding View.

How to import (pull) items

Once you've added a Git repository in the settings, you can 'pull' any View or Card from the repository to the current website.
In the items list table header (Views or Cards), you'll notice a new tab named after your repository. Click on it to view the list of available items. You can then 'import' individual items or perform bulk imports.
Please be aware that importing may take some time, especially if components include Meta Groups data. Therefore, we recommend importing no more than 5 items at once.

Overriding existing items

If you import items that already exist on the website, then they will be overridden instead of creating duplicate entries.