Glass: Property of Template not Populated - sitecore

Sitecore 8.0U5, Glass 4, TDS 5.0.1.11
I've got an interesting problem here and I feel like I'm just being dense somewhere, but can't figure it out.
I've got a template in Sitecore called "Testimonial" that has text fields like "Quote", "Name", "Location". It additionally has a field named "Image" of type "Image".
TDS generates my code and the properties of the template look normal. When viewing the rendering, all the fields are mapped appropriately except for the "Image" field. It is always "NULL".
The image is displayed in my view rendering only when viewing in the Experience Editor. When I 'Preview' or browse to the page, the image does not display. To complicate things, when I put a breakpoint on the rendering line and inspect in either Experience Editor or Preview, "Image" is still NULL. So even though it doesn't appear to be mapped, it still works in the Experience Editor.
I'm running locally and have my site pointed to the master database.
Anyone seen anything like this or have any ideas for additional ways to troubleshoot?
Thanks!

Okay, this is not an issue with Glass. (Not directly, at least) The issue is that there is a third-party module that has a template named Image and when that was mapped by TDS, it was interfering with Sitecore's Image class.
I'm not sure if this was the best solution, but what I ended up doing was editing the T4 template to look for this specific template and update the name when the class is generated. This keeps the module template named appropriately and keeps the compiled code clean as well.

Related

RenderFields Pipeline does not show all Fields in Sitecore

So i was trying to add title tag for all my images in Sitecore.
John West had a solution here
The issue is, I am not getting all the rendering fields in my pipeline. When i debug the Solution, the breakpoints hits only 4 or 5 times totally and they are all different fields either under footer. Interestingly all of them are only "Rich text" Fields. What am i missing? Why am i not getting all the fields under Sitecore.Pipelines.Renderfield.RenderFieldArgs?
I am also using Glassmapper and using #RenderImage to render the images. Couldthat be the reason?
GlasMapper does not run through the RenderField pipeline in Normal mode (it does in edit mode), this issue has been raised before as an issue on Github for String field types.
You can either force it through the pipeline by creating a custom html helper extension which works in much the same way as Glass does in Edit mode.
Or alternatively I'd suggest creating a custom Glass Mapper Data Handler inheriting from SitecoreFieldImageMapper and then overriding the MapToImage methods. Use that as the type for your property or replacing out/insert before the existing mapper registrations in DataMapperConfigFactory.

Final Layout being wiped out when editing text field in Sitecore 8.1

I have a strange issue whereby when I edit a rich text field in the experience editor and save the page, it takes me to the layout not found page.
When switching back to the content editor, I can see that final layout has been completely wiped (the shared remains intact). I've noticed that if I change to the shared layout within the experience editor (via the presentation tab) and perform the same edit - it works fine.
What would cause the final layout to be wiped?
I've noticed that this can be caused by having Final Renderings set on a template's standard values. Currently I can't think of a reason to do this but I can see how it's very easy to accidentally edit a standard values item in the experience editor in the wrong mode.
It's easy to reset presentation details back to standard values in Sitecore, but to my knowledge you can't reset just the final renderings. To avoid having to go through each failing template and manually reset and re-add all the added renderings I've found an easy way to fix it if you have TDS (or similar) installed.
Search for __Final in the /Sitecore/templates folder in the file system.
Delete all the instances of this __Final Renderings field (From the '----field----' line until the next one).
Sync with Sitecore.
Not really a fix to the issue, but when I had to fix >20 templates where this was happening it saved me a lot of time and thought it was worth a share.

Sitecore doesn't render any field types anymore

After a deploy to our Acceptance environment, templates in sitecore seem to be broken. We have installed them back with an item package from a working environment and did a revert on the /sitecore/templates/system tree.
We didn't notice any difficulties here, but when we try to edit with a rich text editor, we see the raw values. Even a tree list is rendered as a single line text field.
Next to that, the /sitecore/templates/system/templates/template item does not contain any fields.
Since we are on an acceptance environment, we cannot revert the entire database in case of data loss.
Do not think I entirely understand your issue, can you please be more specific and give us more details? You say templates are broken, but in what way exactly?Can you try reproducing that to ensure it happens again?
If you see everything as a text value, that happens because of you have Raw values in View tab switch on.

Overriding templates when using Grappelli

I'm using Grappelli with Django. When I follow the procedure as outlined in the Django docs to override a specific template for a specific model, it appears that Django (or Grappelli??) are struggling to render the template correctly.
I have copied the change_form.html file to the templates directory with the following subpath:
admin/properties/Calendar
where properties is the name of the app and Calendar is the name of the model for which I want to override the change form. Now the following appears
At least two things are not rendered correctly:
The breadcrumb bar is much thinner and the crumbs are tightly aligned with the left border of the bar.
The link for the history of changes is in the wrong place (it appears on the left), has the wrong style (no rounded edges) and appears twice.
I double checked that the correct template file is used by Django, so the mechanism as documented works albeit with the above described flaws. When I rename the duplicated template file or delete it from my app, everything looks fine again.
Before I dive into this, I was hoping someone could hint at what is going wrong here. All not overridden templates seem to work just fine.
From what I read I suspect you copy the default admin change_form.html template and not the grapelli version, found at grappelli/templates/admin/change_form.html.
If you want to override a grapelli template, then you should use that as source!

Sitecore Broken Links and Content Editor Issues

We've been noticing an increase in number of broken links on our sitecore website.
Some it is due to
User Training
Publishing Issues (linked page is not yet published)
Maybe content editor issues
It's been hard to verify some of these but sometimes the link might have the authoring page URL (which means someone didn't follow the SOP), sometimes they have a strange url like /shell/Content Editor/...
So we are trying to proactively fix these before the pages go live.
I had a couple ideas like writing a Handler that would look through all "Rich Text Fields" and looking for inconsistencies (like authoring server URL). Also using a crawler-type of validator could help us (http://home.snafu.de/tilman/xenulink.html#Description) but we were wondering what the community was doing to address this issue.
The "internal link checker" usually works well but doesn't detect many of this erroneous setups (as I believe it sees them as 'external links').
Your input is greatly appreciated!
If you have RichText fields and create internal links, your internal link looks like this in the HTML view: "a href="~/link.aspx?_id=EB3AD128E7BF4F3C9F3812F701D7724E&_z=z" and when you hover with your mouse over it, is show "/Sitecore/Shell/Controls/Rich Text Editor/" before the ~/link.aspx. This is normal behavior. This link is modified to a normal link during rendering of the RTE field.
However, be sure to use the Sitecore controls like to render these RTE fields and to render links. Also using sc:fld() in XSLT instead of sc:field() can create strange links because sc:fld is rendering the raw value of the field.
In all of the Sitecore projects I have been working on, I didn't have much issues with broken links.
There is a known bug with copy-pasting links from a rich text editor, where path info is appended to the link (generating the /shell/Content Editor/ stuff).
Sitecore have a fix for it here:
http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/ReleaseNotes/KnownIssues%20Recommended/Copying%20and%20pasting%20link%20in%20rt%20fields%20may%20break%20the%20link.aspx
I would suggest a new Validation Action added to the workflow command before the items are finalized. Then you could actively stop them from being published and give immediate feedback. If you're not using workflows, you could add a new item level validator, but those often get ignored in my experience -- too many false positives on the existing validators.