<?php
namespace Website\Widgets\Integrations; use Moto; class Opentable extends Moto\System\Widgets\AbstractWidget { protected $_name = 'integrations.opentable'; protected static $_defaultProperties = array( 'spacing' => array( 'top' => 'auto', 'right' => 'auto', 'bottom' => 'auto', 'left' => 'auto' ), 'align' => array( 'desktop' => 'left', 'tablet' => '', 'mobile-v' => '', 'mobile-h' => '' ), 'visible_on' => 'mobile-v', 'restaurants' => array(), 'type' => 'standard', 'lang' => 'en-US', ); protected $_templateType = 'templates'; public function getTemplatePath($preset = null) { return '@websiteWidgets/integrations/templates/opentable.twig.html'; } public function getUrl() { $url = '//www.opentable.com/widget/reservation/loader?'; foreach ($this->getPropertyValue('restaurants') as $id) { $url .= 'rid=' . $id . '&'; } if ($this->getPropertyValue('type') === 'button') { $url .= 'type=button&'; $url .= 'theme=standard&'; } else { $url .= 'type=' . (count($this->getPropertyValue('restaurants')) > 1 ? 'multi' : 'standard') . '&'; $url .= 'theme=' . $this->getPropertyValue('type') . '&'; } $url .= 'lang=' . $this->getPropertyValue('lang') . '&'; $url .= 'iframe=true&'; $url .= 'overlay=false&'; $url .= 'domain=com'; return $url; } protected $_widgetId = true; } 