Flowing on from my previous question about writing my first component (now called com_picture) which is nearly an exact clone of the com_contact directory, I have hit a snag with trying to save a new "picture" with a tag.

When I save a picture without a value in the tags field, everything is sweet.

enter image description here

However, when I try to save a picture with a value in the tags field (I mean the cute little blue bubble with the tag value is generated in the tags field in the lower right of the window), I receive a vague/useless bootstrap error:

Error Save failed with the following error:

enter image description here

If I make changes to the Name, Alias, Category, Language, etc. -- all of those changes are preserved after I click save. It is ONLY the tags field that is failing.

I have set my Global Configuration - Server - Error Reporting to: "Development" and read through all of the queries, but there are no INSERT queries (which I expected to see when adding a new tag) and the 2 UPDATE queries are not relating to the tag table. Basically, there are no clues in the 37 queries logged.

If anyone, for some uncanny reasons, actually knows what I've done wrong please share. Otherwise, I'm merely asking how I can generate some informative error messages/clues as to what I've done wrong.

As a bit more background, I've cloned the com_contact directory then done a case-sensitive replacement on all occurrences of contact, Contact, and CONTACT with picture, Picture, and PICTURE -- this was the simplest way forward for this prototype because it seamlessly handled singular/plural versions of the keyword for filenames, classes, functions, variables, etc. I also copied and adjusted all rows in all tables (I believe) which refer to com_contact so that com_picture is represented and all ids are pointing to the correct rows.

And in case it helps to dismiss some suspicions, I am able to generate a full error message when I try to save a duplicate picture in the same category:

Error Save failed with the following error: Another Picture from this category has the same alias (remember it may be a trashed item).

So I am thinking that this eliminates the possibility that I've overlooked a language .ini file. (maybe / maybe not)

I am running Joomla 3.8.12 I am happy to implement any wild guesses so that I can move forward.

I have already updated the #__content_types table by copying the Contact row and making contact -> picture replacements.

(15, 'Picture Category', 'com_picture.category', '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}', '', '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias","core_created_time":"created_time","core_modified_time":"modified_time","core_body":"description", "core_hits":"hits","core_publish_up":"null","core_publish_down":"null","core_access":"access", "core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language", "core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey", "core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"}, "special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}', 'PictureHelperRoute::getCategoryRoute', '{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path","extension"], "ignoreChanges":["modified_user_id", "modified_time", "checked_out", "checked_out_time", "version", "hits", "path"],"convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"created_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"}]}');

To support tags in your component, you must add your content type to #__content_types table.

Documentation: Using Tags in an Extension

You have copied the row where:

`type_title` = 'Contact Category' AND `type_alias` = 'com_contact.category'

To create a new row for:

`type_title` = 'Picture Category' AND `type_alias` = 'com_picture.category'

but you haven't copied the row where:

`type_title` = 'Contact' AND `type_alias` = 'com_contact.contact'

to be a new row for:

`type_title` = 'Picture' AND `type_alias` = 'com_picture.picture'
  • I have updated my question to include the row that I already inserted into the table. – mickmackusa Sep 12 '18 at 9:50
  • I didn't want to bloat my question any farther with a bunch of sql rows that I manufactured, but I might need to add these details for absolute clarity. – mickmackusa Sep 12 '18 at 10:21
  • You added a row for com_picture.category but not for com_picture.picture. – Sharky Sep 12 '18 at 12:29
  • I did read that documentation page, but I mustn't have looked carefully enough about what I was doing. Thanks for the extra pair of eyes. The tags are now saving. Any ideas as to why I can't get version notes to save on any of my components? Or shall I post a new question? – mickmackusa Sep 12 '18 at 20:52
  • 1
    Update files are incremental. They must include only changes introduced with their versions. For example, if you add a new content type in 1.0.1, you need to create a 1.0.1 update file containing the query and also update the install/uninstall files. If you don't make any database changes in 1.0.2, you don't even need a 1.0.2 update file. But if you do, the update file must contain only changes introduced in 1.0.2. Changes from 1.0.1 will be applied automatically from 1.0.1 file. – Sharky Sep 14 '18 at 8:22

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.