PHP code example of imarc / craft-sheetsync
1. Go to this page and download the library: Download imarc/craft-sheetsync library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
imarc / craft-sheetsync example snippets
// ...
'fields' => [
// ...
'someUsers' => function($row, $sync) {
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->sectionId = $sync->section->id;
$criteria->type = $sync->entry_type_id;
$criteria->name = $row['Assistant Name'];
$entries = $criteria->find();
if (count($entries)) {
return [(int) (current($entries)->id)];
} else {
return null;
}
},
],
// ...
'expiryDate' => function($row) {
return new DateTime($row['expiration']);
},