This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import $ from 'jquery' | |
// Request animation frame polyfills | |
const frame = window.requestAnimationFrame ? cb => requestAnimationFrame(cb) : cb => setTimeout(cb, 0) | |
const unframe = window.cancelAnimationFrame ? id => cancelAnimationFrame(id) : id => clearTimeout(id) | |
// Trigger layout redraws around some element | |
const redraw = el => (el instanceof $ ? el[0] : el).offsetWidth | |
// Memoize viewport height so using it is less expensive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the entry model. This could really be any element model, such as a category or Craft Commerce product. | |
$entry = craft()->entries->getEntryById(1234); | |
// Get the Neo field model and the field type model. | |
$field = craft()->fields->getFieldByHandle('neoFieldHandle'); | |
$fieldType = $field->getFieldType(); | |
$fieldType->setElement($entry); |