Remove null
article thumbnail

Choosing Between Ternaries or && in JSX

Perficient

console.log(null && true); //null, right side never evaluated. console.log(null && false); //null, right side never evaluated. //False console.log(0 && true); //0, right side never evaluated. console.log(0 && false) //0, right side never evaluated.

article thumbnail

Restricting available types based on site context in Episerver

Perficient

_siteDefinitionResolver.GetByContent(content.ContentLink, false, false) : SiteDefinition.Current; foreach (var targetType in contentTypes) { if (siteDefinition == null) yield return targetType; var modelType = targetType.ModelType; if (modelType !=

Video 322
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

article thumbnail

AEM Customization: Show Unpublished Reference Alert for Content Path

Perficient

register("foundation.validation.validator", { selector: "foundation-autocomplete", validate: function (element) { var ctaUrl = element.value; // Check if pathfield/xffield value is not null then show notification. null) { checkIfPublishedUrl(ctaUrl); } } }); // Check whether selected content path is published or not. getJSON(url).done(function

Data 520
article thumbnail

Defer offscreen images in Episerver

Perficient

null) { var lazy = ViewBag.lazy ?? This file will instruct Episerver on how to render the markup for an Image. In my case, Image.cshtml looks like this ( assuming we’re following along with Alloy… ): @using EPiServer.Editor @model ImageViewModel @if (Model != true; if (PageEditing.PageIsInEditMode || !lazy) Value; if (!string.IsNullOrEmpty(src))

Data 348
article thumbnail

Episerver and Alternate Text for Images in the TinyMCE Rich Text Editor

Perficient

My extension method looks something like this: public static string FixAlternateText(this XhtmlString html, ViewContext context) { // html is null when the TinyMce is not initialize (creating new block etc.), so just return if (html == null) return string.Empty; // generate a dictionary of <Url, AltText> as strings.

How To 294
article thumbnail

AEM Customization: Show Unpublished Reference Alert for Tagpicker

Perficient

null) { checkReplicationStatus(tagPath); } } }); // Check when coral-Pathbrowser-picker dialog is open. > <jcr:root xmlns:cq="[link] xmlns:jcr="[link]. jcr:primaryType="cq:ClientLibraryFolder". adaptTo("foundation-registry").register("foundation.validation.validator", register("foundation.validation.validator", { selector: ".js-cq-TagsPickerField.js-coral-pathbrowser-input",

Data 568
article thumbnail

Implementing Workflow in Sitecore: A Mini-Series Part 3 – Applying Workflow

Perficient

public override void Apply(TRuleContext ruleContext) { if (ruleContext.Item == null) return; if (!ID.IsID(workflowid)) After following the steps written in that blog post, I would recommend making the changes below for this Simple Workflow. WorkflowProvider.GetWorkflow(workflowid); if (workflow != ruleContext.Item.Fields["__Workflow"].Value

How To 309