page.writeStart("h2").writeHtml("Create New").writeEnd();
page.writeStart("ul", "class", "links pageThumbnails");
for (TypeTemplate typeTemplate : favorites) {
ObjectType type = typeTemplate.type;
Template template = typeTemplate.template;
State state = State.getInstance(Query.fromType(type).where("cms.template.default = ?", template).first());
String permalink = null;
if (state != null) {
permalink = state.as(Directory.ObjectModification.class).getPermalink();
}
page.writeStart("li", "data-preview-url", permalink);
page.writeStart("a",
"target", "_top",
"href", page.url("/content/edit.jsp",
"typeId", type.getId(),
"templateId", template != null ? template.getId() : null));
page.writeHtml(getTypeTemplateLabel(typeCounts, typeTemplate));
page.writeEnd();
page.writeEnd();
}
page.writeEnd();