Actions

Using Content History in your Component

From Joomla! Documentation

Revision as of 17:24, 2 November 2013 by Dextercowley (Talk | contribs)

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.

Contents

Set up Working Environment

  1. Install a new instance of Joomla version 3.2 on your local workstation.
  2. Install the example component using the file com_joomprosubs_3.2.0.zip 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

Add Component Level Options

Update Content History During Table Save and Delete

Add Versions Button to Tool Bar

Add Version Note Field to Form

Add Labels to Pop-Up Windows

Update Extension SQL Files