Auto Sort package for Umbraco released
The options I ended up with in the end are the following:
- The field to sort the nodes by. Currently supported are
- node name
- id
- creation date
- note type alias and
- custom fields (you have to provide the alias of your custom property);
- update date
- release date
- expiry date and
- creator name
- Sort either ascending or descending (default: ascending)
- Include grand children in the sort or not. Including grand children will sort ALL children and grand children by the field you have selected recursively. (default: exclude grand children)
- Include all unpublished nodes in the sort, or choose to exclude them. (default: include)
- If you exclude unpublished nodes from the sort you will need to provide the location of the unpublished nodes, either at the top of the list or at the bottom (default: top)
Once the first sort using node name was working it was a nearly a breeze to make the additional options work as well. Some issues occurred with regards to the differences between content and media nodes, but nothing that a couple of if-else statements couldn’t handle. Here are some screen shots:
The trickier bit was then to add support for multiple languages. The respective keys had to be added to the specific language xml files in /umbraco/config/lang. The Package Actions Contrib package by Richard Soeteman (essential for each Umbraco package builder) contains the fantastic AddLanguageFileKey action by Chris Houston, which would have done the deed yet would also have been a bit cumbersome since I had to add like 20 keys for each language, and also I wanted to add my own area in the language files. So I extended the custom package action to take a list of key-value-pairs and the name for a new are to create the section in the specified language file [note to self: send the code to Richard Soeteman so he can add it to the contrib package]. At the time of writing there are only 2 languages missing thanks to the community, which is absolutely awesome, I’ll include them shortly in the package. Credit goes to the following translators:
- kows for the Dutch version
- Patrik Wibron for the Swedish version
- Mike for the French version
- Morten Balle for the Dansk version
- ricardo for Italiano and Spanish (double high five!)
- Korean version anyone?
- Norwegian maybe?
I hope you enjoy the package and that it makes your life even easier than developing web sites with Umbraco already is. Skål!