Create New Attribute Type


(Nic Hubbard) #1

I am needing to create a new attribute type, but I am getting errors when running step_03 after creating it.


I created my new custom attribute just like any other attribute type in /core/attribute, then I added my new attribute type to the management file in an asset that I am building, as well as the details screen xml and locals xml.



But, when running step_03 I get the following error:


    +---------------------------------------------------------------------------------------+
    | MySource Warning																	  |
    |---------------------------------------------------------------------------------------|
    | File : /Users/nnhubbard/Sites/mysource_matrix/core/include/locale_manager.inc		 |
    | Line : 504																			|
    |---------------------------------------------------------------------------------------|
    | Attribute Type "secret" is not known (for the "news_item" Asset Type) '  [SYS0096] |
    +---------------------------------------------------------------------------------------+
    +-------------------------------------------------------------------------------+
    | MySource Warning															  |
    |-------------------------------------------------------------------------------|
    | File : /Users/nnhubbard/Sites/mysource_matrix/core/include/locale_manager.inc |
    | Line : 504																	|
    |-------------------------------------------------------------------------------|
    | Unable to Commit, Transaction has already been aborted [SYS0220]			  |
    +-------------------------------------------------------------------------------+


Do I need to specify my new attribute type in another file as well?

(Ashish Karelia) #2

[quote]I am needing to create a new attribute type, but I am getting errors when running step_03 after creating it.


I created my new custom attribute just like any other attribute type in /core/attribute, then I added my new attribute type to the management file in an asset that I am building, as well as the details screen xml and locals xml.



But, when running step_03 I get the following error:


    +---------------------------------------------------------------------------------------+
    | MySource Warning																	  |
    |---------------------------------------------------------------------------------------|
    | File : /Users/nnhubbard/Sites/mysource_matrix/core/include/locale_manager.inc		 |
    | Line : 504																			|
    |---------------------------------------------------------------------------------------|
    | Attribute Type "secret" is not known (for the "news_item" Asset Type) '  [SYS0096] |
    +---------------------------------------------------------------------------------------+
    +-------------------------------------------------------------------------------+
    | MySource Warning															  |
    |-------------------------------------------------------------------------------|
    | File : /Users/nnhubbard/Sites/mysource_matrix/core/include/locale_manager.inc |
    | Line : 504																	|
    |-------------------------------------------------------------------------------|
    | Unable to Commit, Transaction has already been aborted [SYS0220]			  |
    +-------------------------------------------------------------------------------+


Do I need to specify my new attribute type in another file as well?[/quote]


Hi,
Did u try running php install/compile_locale.php . before running step 3? :o
If any changes are made to .xml files its a good idea to run it. As a matter of fact step02 + compile + step03 + compile wont hurt either ;)

Regards

Ash :ph34r:

(Nic Hubbard) #3

[quote]Hi,
Did u try running php install/compile_locale.php . before running step 3? :o

If any changes are made to .xml files its a good idea to run it. As a matter of fact step02 + compile + step03 + compile wont hurt either :wink:



Regards



Ash :ph34r:[/quote]



Yes, I have ran compile_locals and step_02 many times. It seems like somehow my attribute needs to be installed to be recognized.



Could someone comment on anything specific that needs to be done to add a new attribute type?


(Nic Hubbard) #4

Anyone?


I just want to make sure I am going through the correct process to create an attribute, as there is no documentation for this.


(Mark Brydon) #5

Please increment the version number in the asset.xml file for the News Item asset. Place this version number in the 'added_to' value for the new attribute in the management file. Running step_03 should then bring this into the system - it's in the "sq_ast_attr" table for your attribute's type code.



For example:

    SELECT * FROM sq_ast_attr WHERE default_type_code = 'news_item';
will show all of the attributes for the News Item asset (hopefully including your new one).

Please note that as this is not an asset, it will not be listed in the items installed / updated by step_03.

(Nic Hubbard) #6

[quote]Please increment the version number in the asset.xml file for the News Item asset. Place this version number in the 'added_to' value for the new attribute in the management file. Running step_03 should then bring this into the system - it's in the "sq_ast_attr" table for your attribute's type code.


For example:

    SELECT * FROM sq_ast_attr WHERE default_type_code = 'news_item';
will show all of the attributes for the News Item asset (hopefully including your new one).

Please note that as this is not an asset, it will not be listed in the items installed / updated by step_03.[/quote]

Thanks Mark, I have it up and working now!

What exactly are the edit_params for attributes? And where do these values come from?

(Huan Nguyen) #7

These edit_params for attributes are used when you use edit_interface_screen***.xml file to format the display of the asset in backend, for example

    		
    			
    		
    		
    			
    		
    		
    			
    		
    		
    			
    		


In this piece of code, "width", "style", "true_text", "false_text" are edit_params of each of different attribute types. You can find out what edit_params available for each of the attribute type by looking into core/attributes/*attribute_name.inc*

(Nic Hubbard) #8

[quote]These edit_params for attributes are used when you use edit_interface_screen***.xml file to format the display of the asset in backend, for example

    		
    			
    		
    		
    			
    		
    		
    			
    		
    		
    			
    		


In this piece of code, "width", "style", "true_text", "false_text" are edit_params of each of different attribute types. You can find out what edit_params available for each of the attribute type by looking into core/attributes/*attribute_name.inc*[/quote]

Perfect, thanks!