Craft CMS
Este conteúdo não está disponível em sua língua ainda.
The Wink Craft CMS Plugin integrates Wink travel inventory into Craft 5 via Twig template functions and a custom field type for the content editor. Editors can pick a specific Wink layout from a dropdown directly in the entry editor.
wink-travel/wink-craft-plugin on GitHub Source code, developer setup guide, and contribution instructions.
Requirements
Section titled “Requirements”- Craft CMS 5.x
- PHP 8.1+
- Composer
Install
Section titled “Install”- Install via Composer:
Terminal window composer require wink2travel/craft-wink - Activate the plugin in the Control Panel at Settings → Plugins, or via CLI:
Terminal window php craft plugin/install wink - Go to Settings → Wink in the Control Panel.
- Enter your Client ID and Client Secret, select your environment, and click Save. Go to Applications to retrieve your credentials.
Use in Twig templates
Section titled “Use in Twig templates”Once configured, call Wink Twig functions anywhere in your templates:
{# Render a hotel grid #}{{ winkContent('HOTEL', entry.winkLayoutId) }}
{# Destination search bar #}{{ winkLookup() }}
{# Itinerary picker button #}{{ winkSearch() }}
{# User account button #}{{ winkAccount() }}The winkContent() function automatically injects <wink-app-loader> the first time it’s called on a page.
Available Twig functions
Section titled “Available Twig functions”| Function | Output | Description |
|---|---|---|
winkContent(layout, id) | <wink-content-loader> | Hotel cards, grids, maps |
winkLookup() | <wink-lookup> | Destination search bar |
winkSearch() | <wink-search-button> | Itinerary picker button |
winkAccount() | <wink-account-button> | Sign-in / user account |
winkItinerary() | <wink-itinerary-button> | Itinerary status button |
winkShoppingCart() | <wink-shopping-cart-button> | Cart button |
Wink Layout field type
Section titled “Wink Layout field type”Add a Wink Layout field to any section to give editors a dropdown of all available layouts from your Wink account:
- Go to Settings → Fields → New Field.
- Set Field Type to Wink Layout.
- Add the field to your entry type’s field layout.
- Editors can now pick a layout directly in the entry editor — no copy-pasting IDs.
In your template, pass the field value to winkContent():
{{ winkContent(entry.winkLayout.type, entry.winkLayout.id) }}