DataProviderNode.php in RESTful 7.2
File
src/Plugin/resource/DataProvider/DataProviderNode.php
View source
<?php
namespace Drupal\restful\Plugin\resource\DataProvider;
class DataProviderNode extends DataProviderEntity implements DataProviderInterface {
public function getQueryForList() {
$query = parent::getQueryForList();
$query
->propertyCondition('status', NODE_PUBLISHED);
return $query;
}
public function getQueryCount() {
$query = parent::getQueryCount();
$query
->propertyCondition('status', NODE_PUBLISHED);
return $query;
}
public function entityPreSave(\EntityDrupalWrapper $wrapper) {
$node = $wrapper
->value();
if (!empty($node->nid)) {
return;
}
node_object_prepare($node);
$node->uid = $this
->getAccount()->uid;
}
}