For a custom asset I am building I have some keywords in the insert keyword drop-down (asset listing) that I had used, but then deleted from my management file, as I no longer needed those attributes. But, I can't get those to be removed from the keywords drop down. Running step_03 and compile_locals multiple times never removed these. Is there something I need to do manually get make these disappear?
Removing Items from Insert Keyword List
Hey Nic,
I believe you want to remove all the keywords that this asset provide in the "Insert Keyword" dropdown? It is true that running step3 won't reverse the requestKeywords event registered in the first place. You'd have to modify your data/private/events/event_listeners.inc file and remove all the array entry that has the name of your custom asset type. By doing that, no content type will ask your custom asset for a list of keywords when it is loading. Unfortunately, this is an issue that is hardly noticeable.
[quote]Hey Nic,
I believe you want to remove all the keywords that this asset provide in the "Insert Keyword" dropdown? It is true that running step3 won't reverse the requestKeywords event registered in the first place. You'd have to modify your data/private/events/event_listeners.inc file and remove all the array entry that has the name of your custom asset type. By doing that, no content type will ask your custom asset for a list of keywords when it is loading. Unfortunately, this is an issue that is hardly noticeable.[/quote]
Well, I still want to use the other attributes that I created, but there is just one that I removed from my custom assets management file, and that keyword still shows up in the dropdown. And since it is no longer an attribute it is problematic. Are you saying that I need to follow your steps above to fix this?
These attribute keywords are likely being referenced from the sq_ast_attr table - presuming the attributes are being shown in the keywords list
as "Asset Attribute: attr_name_here". The attributes will still be associated with Matrix internally. As long as you really really don't need the associated data, the attribute values and attributes can be removed from the database. It would also be a good time to check any other listings or metadata fields that may be referring to this attribute before proceeding.
With all system-level modifications I recommend taking a backup first. This helps me to sleep at night .
Ok… firstly the attribute will need to be found:
SELECT attrid FROM sq_ast_attr WHERE type_code = 'your_type_code' AND name = 'attr_name_here';
Then the disassociate the values and the attribute itself from the asset.
DELETE FROM sq_ast_attr_val WHERE attrid = [attr_id_from_previous_query]; DELETE FROM sq_ast_attr WHERE attrid = [attr_id_from_previous_query];
[Pulls HIPO out of hat] The attributes should then disappear from the automatically-generated keyword list.
Edit: Inserted missing definite article
Did you implement _getContentsKeywords() in your custom asset type? That function would handle the list of keywords made available to the "Insert Keywords" dropdown. If you did then you should update this function and remove the keyword for the attribute that you deleted.
(if not the above) How did you make the attribute keywords available to the "Insert Keywords" dropdown in the first place?
[quote]Did you implement _getContentsKeywords() in your custom asset type? That function would handle the list of keywords made available to the "Insert Keywords" dropdown. If you did then you should update this function and remove the keyword for the attribute that you deleted.
(if not the above) How did you make the attribute keywords available to the "Insert Keywords" dropdown in the first place?[/quote]
I am using getAvailableKeywords() to define the keywords and then getKeywordReplacement($keyword) for the code that populates those keywords.
I have traced this (not till the end) but, like Mark said, these attribute are likely to be referenced from the sq_ast_attr table.
If you look at asset.inc::getAvailableKeywords function, it look into the object "vars" instance variable and try to add all the attribute of the object as keywords. If you call bam($this) somewhere while it's painting in the backend, you would see that your old attribute is still there in the object's "vars" instance variable . In a normal development process, when an attribute is added/ deleted from an asset, we would write an upgrade function to add/ remove these attributes from the database, and increase the asset version by probably 0.1, so step 3 would know and run the upgrade function. You can look at one of the example in core/assets/files/file/file_management.inc on how to write an upgrade function. In your case I would suggest to follow Mark's instruction to delete the attribute from the sq_ast_attr and sq_ast_attr_val table.
[quote]I have traced this (not till the end) but, like Mark said, these attribute are likely to be referenced from the sq_ast_attr table.
If you look at asset.inc::getAvailableKeywords function, it look into the object "vars" instance variable and try to add all the attribute of the object as keywords. If you call bam($this) somewhere while it's painting in the backend, you would see that your old attribute is still there in the object's "vars" instance variable . In a normal development process, when an attribute is added/ deleted from an asset, we would write an upgrade function to add/ remove these attributes from the database, and increase the asset version by probably 0.1, so step 3 would know and run the upgrade function. You can look at one of the example in core/assets/files/file/file_management.inc on how to write an upgrade function. In your case I would suggest to follow Mark's instruction to delete the attribute from the sq_ast_attr and sq_ast_attr_val table.[/quote]
Thanks for the help on this, I really appreciate it!