Skip to content

Instantly share code, notes, and snippets.

@sergant210
Created February 2, 2016 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergant210/c730268134fe84cbdec0 to your computer and use it in GitHub Desktop.
Save sergant210/c730268134fe84cbdec0 to your computer and use it in GitHub Desktop.
<?php
$oneBooking = $modx->getService('onebooking','oneBooking',$modx->getOption('core_path').'components/onebooking/model/onebooking/', $scriptProperties);
if (!($oneBooking instanceof oneBooking)) return '';
$included = array();
if (!empty($scriptProperties['fields'])) {
$included = explode(',',$scriptProperties['fields']);
array_walk($included,'trim');
}
$fields = false;
foreach($oneBooking->extras as $name=>$data) {
if ($included && !in_array($name,$included)) {
$fields[$name] = '';
} else {
$fields[$name] = $data['field'];
}
}
if ($fields) $modx->setPlaceholders($fields,'ob.');
return '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment