THIS IS ARCHIVED DOCUMENTATION

Prebinding Helpers List Reference

This page contains an extensive list of the prebinding methods used in Coveo for Sitecore Hive Framework.

fieldTranslator

Translates the given field according to the current context.

The following line:

<div data-field="@myfield" data-prebind-field="fieldTranslator"></div>

Gives the following result:

<div data-field="@fmyfield2053" data-prebind-field="fieldTranslator"></div>

analyticsEnabled

Outputs true or false whether the analytics are enabled or not.

The following line:

<div data-prebind-send-analytics="analyticsEnabled"></div>

Gives the following result:

<div data-send-analytics="true" data-prebind-send-analytics="analyticsEnabled"></div>

coveoForSitecoreAnalyticsEndpoint

If the value isn’t defined, assigns it a default endpoint value extracted from the context.

An existing value won’t be overridden by this prebiding method.

The following line:

<div data-prebind-endpoint="coveoForSitecoreAnalyticsEndpoint"></div>

Gives the following result:

<div data-endpoint="mysite/coveo/rest/analytics" data-prebind-endpoint="coveoForSitecoreAnalyticsEndpoint"></div>

currentPageName

If the value isn’t defined, assigns it the current page name value extracted from the context.

An existing value won’t be overridden by this prebiding method.

The following line:

<div data-prebind-page-name="currentPageName"></div>

Gives the following result:

<div data-page-name="mypage" data-prebind-page-name="currentPageName"></div>

isAnonymous

Outputs true or false whether the user is logged in or not.

The following line:

<div data-prebind-anonymous="isAnonymous"></div>

Gives the following result:

<div data-anonymous="true" data-prebind-anonymous="isAnonymous"></div>

sortCriteria

Takes a JSON object representing a sort criteria and outputs the translated criteria.

The following line:

<div data-sort='{ "type": "field", "direction": "ascending", "field": "myfield" }' data-prebind-sort="sortCriteria"></div>

Gives the following result:

<div data-sort='@fmyfield2053 ascending' data-prebind-sort="sortCriteria"></div>

You can add the sc-enable-direction-toggle="true" attribute to add a toggle for the sort criteria.

The following line:

<div data-sort='{ "type": "field", "direction": "ascending", "field": "myfield" }' data-sc-enable-direction-toggle="true" data-prebind-sort="sortCriteria"></div>

Gives the following result:

<div data-sort='@fmyfield2053 ascending, @fmyfield2053 descending' data-prebind-sort="sortCriteria"></div>

unfoldDictionaryToAttributes

Takes a JSON dictionary as its original value and assigns an attribute for each of them with their value.

The following line:

<div data-dictionary='{ "attribute": "value" }' data-prebind-dictionary="unfoldDictionaryToAttributes"></div>

Gives the following result:

<div data-attribute="value" data-dictionary='{ "attribute": "value" }' data-prebind-dictionary="unfoldDictionaryToAttributes"></div>