CET Developer Guides
Catalogue Table of Contents wi...
Tutorial: Facelifting Hybrid Catalog Libraries
14 min
we will be using the term "hybrid catalog libraries" synonymously with any method used to code a library using information from catalogs, or any methods combining the use of coding with data driven content, including the use of dsdatacataloglimb overview in general, there are 3 main steps when it comes to facelifting hybrid catalog libraries building the librarylimb tree building the header building the library object but before we jump into it, you have a choice on your new ui deployment strategy show the facelifted library according to cet's facelift mode toggle, or show facelifted library at all times (regardless of cet's facelift mode toggle) usually we recommend the first choice, but going for the second choice is fine too if you want to save time by removing code related to classic toolbox libraries migration strategies are detailed more in new ui adoption info docid 6gt6if5vsp9epg7g9cpig facelift and classic / my toolbox library / public library mytoolboxlibrary() { if (usefacelift) { return myfaceliftedtoolboxlibrary( ); } return myclassictoolboxlibrary( ); } facelift only / my toolbox library / public library mytoolboxlibrary() { // code to build up the facelifted library return dstoclibrary( ); } part 0 clean up your data depending on your existing data, you may want to clean up your existing catalogue following tutorial structuring your table of contents for data driven catalogues docid 8agivqykiirq5mtadudq part 1 build out librarylimb tree as with all libraries, a root librarylimb will hold instructions on how to build the library depending on your use case, there are two choices to build out your librarylimb tree tutorial facelifting hybrid catalog libraries /#appendfaceliftcataloglimb we recommend using this if you just want a simple facelift process, built using the default dstoolboxthumbnail tutorial facelifting hybrid catalog libraries /#customize catalogtoclimbbuilder usually you would choose this option if you want customize dstoolboxthumbnail, or other building process in catalogtoclimbbuilder while your existing dsdatacataloglimb can be used for this purpose, keep in mind it still only appends librarylimb s using the old catalog toc structure (section, subsection, icon, none, undefined) we plan to phase out the old catalog toc structure in the future appendfaceliftcataloglimb() appendfaceliftcataloglimb(librarylimb root, datacatalog catalog, dssqlimportactivecatsinfo info=null, str cardproductlevelcode=null, dsdatacataloglimbenv env=dsdatacataloglimbenv()) librarylimb root the root librarylimb to build out datacatalog catalog the datacatalog object that holds all the information needed to append in the librarylimb dssqlimportactivecatsinfo info this is effectively the product catalogue selection under the product catalogues tab in catalog creator a map of dssqlimportactivecatsinfo can be found under the datacatalog 's activefilteredprdcatalogs() these are named after the code version of the selected product catalogue if a specific info is not passed here, all product catalogues will used be used to append the limb str cardproductlevelcode (requires info to be defined to work ) if cardproductlevelcode is defined, only that card product level with the same code will be used to append the limb if this is not defined, all product levels not under a card product level will be appended dsdatacataloglimbenv env this env is used evaluate the ui level of a product level, header text alignment of a subsection, and check if the datacatalog has a scheme, and to then create a scheme button only pass in your own custom env if you want to further customize these behaviors customize catalogtoclimbbuilder similar to appendfaceliftcataloglimb() , create your own catalogtoclimbbuilder then call its appendproductcatalogue(librarylimb) to begin building out the librarylimb tree this is a better choice if you want to customize how the dstoolboxthumbnail is built for your extension, or customize other behaviors within catalogtoclimbbuilder part 2 building the header use the following libraryheaderbuilder classes accordingly basiclibraryheaderbuilder for most use cases; tabbedlibraryheaderbuilder if your librarylimb tree has any tablimb s in it here we highlight some additional features you can add into the header area refer to extension header docid 329vj0pqzc4rwqu qmv3d for more info adding buttons (optional) if you have any additional buttons you might want to add into your header such as this you can consider building a button object, and passing it into the header using the header builder's addbutton method schemes (optional) if your library has a catalog scheme you want to link, the key of the scheme has to be found first in with the key in your possesion, you can pass it as the schemekey argument in the header builder class the scheme button and dropdown will then be built automatically just like how the fika office extension does it part 3 build and return dstoclibrary usually we return a library or companylibrary object from the library function but for this case, we have a special dstoclibrary class for this purpose, it comes with an extra argument in its constructor, ownercardkey ownercardkey this argument in dstoclibrary is the unique identifier of the extensiontoolboxcard your library will be built upon its usually just a concatenation of the package and library function name, with a ';' between them examples package library function name ownercardkey custom fika office fikaofficelibrary custom fika office;fikaofficelibrary custom accessories human stdhumanlibrary custom accessories human;stdhumanlibrary dstoclibrary finally, with all the ingredients we need, create a dstoclibrary passing these arguments librarylimb tree pass the root librarylimb created in part 1 above symbol pkg the package where the library function belongs to use #\ package from the function to easily generate and pass this argument bool rebuildonuserlevelchange this argument is unused bool facelift enable this to build this library with facelifted ui(section, send to custom tools button, buttons for products, etc ) you can either pass in usefacelift , or just true , depending if you want to build this library with the classic look if cet's facelift is toggled libraryheaderbuilder headerbuilder pass in the libraryheaderbuilder object from part 2 function() viewmodehook this is a callback triggered when the user selects this library intended to set the viewmode s tied to this library calls setdefaultviewmodes if this argument is not set str ownercardkey pass the ownercardkey as explained above finally, return the dstoclibrary to the library function, and you are done!