2

In the component of Article Manager, right after saving the article, it is automatically set as the current version of the article. I can't find the code that it stores the data also to the ucm_history table. I want to make changes to it as when I save the article, it does not automatically become the current version, wherein I need to go to versions toolbar to set it as the current version.

Also, in the global configuration of Articles in the Editing Layout section, since Save History option is set to Yes, I want to get that part of the code so I can make customization which I mentioned earlier but in the com_content/models/article.php on the Save function, it does not include the code for storing data to the ucm_history table.

UPDATE: 4:56pm https://docs.joomla.org/Using_Content_History_in_your_Component#Add_Rows_to_Content_Types_Table

I downloaded the file from this link and after reading the tutorial, there was no special code for using the table of ucm_history, they only added the line of code in a table class: for the component to be able to use content versioning:

JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', 'JoomprosubsTableSubscription', array('typeAlias' => 'com_joomprosubs.subscription'));

But after installing the sample component from the link, it still does not work.

any thoughts?

4

Well, Joomla is a mix of old and new. Contenthistory does not use classic events but the observer pattern. Take a look into JTableObserverContenthistory (libraries/joomla/table/observer/contenthistory.php).

You can find the "hook" in JTableContent->__construct() (libraries/legacy/table/content.php line 34):

JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_content.article'));

That's where the observer is being created.

1

I have fixed the error, I just needed to add the params for save history and I added this line in the construct method:

JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_joomprosubs.subscription'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.