Record display - record template (See diff)
This is the main template for the display portion of our database.
Here's the final code:
<div class='ipsClearfix'> <h1 class='ipsType_pageTitle ipsType_largeTitle ipsType_break'> IPS Community Suite {wordbreak="$record->_title"} {{if $record->isFutureDate() || $record->mapped('pinned') || $record->mapped('featured') || $record->hidden() === -1 || $record->hidden() === 1}} {{if $record->isFutureDate()}} <span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->futureDateBlurb()}'><i class='fa fa-clock-o'></i></span> {{elseif $record->hidden() === -1}} <span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span> {{elseif $record->hidden() === 1}} <span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span> {{endif}} {{if $record->mapped('pinned')}} <span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span> {{endif}} {{if $record->mapped('featured')}} <span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span> {{endif}} {{endif}} </h1> <p class='ipsType_reset ipsType_large'>{$record->customFieldDisplayByKey('release-date', 'display')|raw}</p> {$record->customFieldDisplayByKey('security-release', 'display')|raw} </div> <hr class='ipsHr'> {{if count( $record->tags() )}} {template="tags" group="global" app="core" params="$record->tags()"} {{endif}} <article class='ipsContained ipsSpacer_top'> <div class='ipsClearfix'> <section class="ipsType_richText ipsType_normal" data-controller='core.front.core.lightboxedImages'> <h2 class='ipsType_pageTitle'>Key Changes</h2> {$record->_content|raw} </section> {{if $record->fieldValues()['field_164']}} <section class="ipsSpacer_top ipsSpacer_double ipsType_richText ipsType_normal" data-controller='core.front.core.lightboxedImages'> <h2 class='ipsType_pageTitle'>Additional Information</h2> {$record->customFieldDisplayByKey('additional-information', 'display')|raw} </section> {{endif}} </div> <hr class='ipsHr ipsClear ipsClearfix'> {{if $record->isFutureDate() or $record->canPin() or $record->canUnpin() or $record->canFeature() or $record->canUnfeature() or $record->canHide() or $record->canUnhide() or $record->canMove() or $record->canLock() or $record->canUnlock() or $record->canDelete()}} <a href='#elentryActions_menu' id='elentryActions' class='ipsButton ipsButton_light ipsButton_verySmall' data-ipsMenu>{lang="content_record_actions" sprintf="$record::database()->recordWord( 1, TRUE )"} <i class='fa fa-caret-down'></i></a> <ul id='elentryActions_menu' class='ipsMenu ipsMenu_auto ipsHide'> {{if $record->isFutureDate() and $record::canFuturePublish( NULL, $record->container() )}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'publish' ) )}' data-confirm title='{lang="publish_now"}'>{lang="publish"}</a></li> {{endif}} {{if $record->canFeature()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'feature' ) )}' title='{lang="feature_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="feature"}</a></li> {{endif}} {{if $record->canUnfeature()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'unfeature' ) )}' title='{lang="unfeature_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="unfeature"}</a></li> {{endif}} {{if $record->canPin()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'pin' ) )}' title='{lang="pin_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="pin"}</a></li> {{endif}} {{if $record->canUnpin()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'unpin' ) )}' title='{lang="unpin_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="unpin"}</a></li> {{endif}} {{if $record->canHide()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'hide' ) )}' title='{lang="hide_title_record" sprintf="$record::database()->recordWord(1)"}' data-ipsDialog data-ipsDialog-title="{lang="hide"}">{lang="hide"}</a></li> {{endif}} {{if $record->canUnhide()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'unhide' ) )}' title='{{if $record->hidden() === 1}}{lang="approve_title_record" sprintf="$record::database()->recordWord(1)"}{{else}}{lang="unhide_title_record" sprintf="$record::database()->recordWord(1)"}{{endif}}'>{{if $record->hidden() === 1}}{lang="approve"}{{else}}{lang="unhide"}{{endif}}</a></li> {{endif}} {{if $record->canLock()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'lock' ) )}' title='{lang="lock_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="lock"}</a></li> {{endif}} {{if $record->canUnlock()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'unlock' ) )}' title='{lang="unlock_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="unlock"}</a></li> {{endif}} {{if $record->canMove()}} <li class='ipsMenu_item'><a href='{$record->url('move')->csrf()}' data-ipsDialog data-ipsDialog-title="{lang="move"}" title='{lang="move_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="move"}</a></li> {{endif}} {{if $record->canDelete()}} <li class='ipsMenu_item'><a href='{$record->url('moderate')->csrf()->setQueryString( array( 'action' => 'delete' ) )}' data-confirm title='{lang="delete_title_record" sprintf="$record::database()->recordWord(1)"}'>{lang="delete"}</a></li> {{endif}} </ul> {{endif}} {{if $record->canEdit()}} <a href='{$record->url('edit')->csrf()}' title='{lang="edit_title"}'>{lang="edit"}</a> {{endif}} {{if $record->canManageRevisions()}} <a href='{$record->url('revisions')}' title="{lang="content_view_revisions"}">{lang="content_view_revisions"}</a> {{endif}} </article> <br> {{if $updateForm}} <div class='ipsAreaBackground_light ipsPad'> <h2 class='ipsType_sectionHead'>{lang="cms_front_update_fields" sprintf="$record::database()->recordWord( 1 )"}</h2> <ul class='ipsForm ipsForm_vertical'> {$updateForm|raw} </ul> </div> {{endif}}
There isn't too much going on here that hasn't already been explained. We're using the customFieldDisplayByKey method of the record to output our formatted fields, although we're using the display type this time:
{$record->customFieldDisplayByKey('security_release', 'display')|raw}
We also check the raw field value of the Additional Information field to determine whether there's any content to display for it. As before, you'll need to replace the ID number with the correct one from your own database:
{{if $record->fieldValues()['field_164']}}
...
{{endif}}
We also strip out features we know aren't needed in this case: following, reputation, pager controls for moving between records (the latter isn't needed because all of our records are shown in the listing on the same page!).
Report Guide