Using Content History in your Component

From Joomla! Documentation

In version 3.2, Joomla added the ability to track content history (also called versions) for all core components. This allows you to view and restore from prior versions of an article, banner, category, and other content types. This feature can easily be added to third-party components. This tutorial shows you how to do this. We will illustrate this by adding content history to an example component.

Important Note: This tutorial assumes that the component uses a JTable sub-class for the "CRUD" operations. If your component does not use JTable then the simplest thing to do is to re-work your component to use JTable's store() and delete() methods. If you do that, you will be able to use the methods described in this tutorial.

Set up Working Environment[edit]

  1. Install a new instance of Joomla version 3.2 on your local workstation.
  2. Install the example component using the file in the Extension Manager: Install screen. You can get the ZIP archive here: <to be filled in when available>.

At this point, you should be able to see the Joompro Subscriptions component in the Components menu in the back end of Joomla. This is the component before we have added content history to it.

Add Rows to Content Types Table[edit]

Add Component Level Options[edit]

Update Content History During Table Save and Delete[edit]

Add Versions Button to Tool Bar[edit]

Add Version Note Field to Form[edit]

Add Labels to Pop-Up Windows[edit]

Update Extension SQL Files[edit]