Skip to content

Instantly share code, notes, and snippets.

View amitaibu's full-sized avatar

Amitai Burstein amitaibu

View GitHub Profile
function c4m_og_access() {
if (!og_context_is_init()) {
// OG context wasn't called yet, so we can't call og_context() ourself yet.
return;
}
if (!$og_context = og_context()) {
// No OG context.
return;
}
$plugin = array(
'label' => t('Articles'),
'resource' => 'articles',
'name' => 'articles__1_7',
'entity_type' => 'node',
'bundle' => 'article',
'description' => t('Export the article content type using view modes.'),
'class' => 'RestfulEntityBaseNode',
'authentication_types' => TRUE,
'authentication_optional' => TRUE,
return array('uploaded a moment. file: ' . $name);
``return parent::createEntity();``
{
"_links": {
"self": {
"href": "http://s4ba560702504edc.s3.simplytest.me/node/1"
},
"type": {
"href": "http://s4ba560702504edc.s3.simplytest.me/rest/type/node/article"
},
"http://s4ba560702504edc.s3.simplytest.me/rest/relation/node/article/uid": [
{
UPDATE `users` SET `mail`=concat(mail, '.test') WHERE `uid` > 0
<?php
/**
* @file
* Contains RestfulTokenAuthenticationTestCase.
*/
class RestfulTokenAuthenticationTestCase extends DrupalWebTestCase {
public static function getInfo() {
/**
* Implements hook_ctools_plugin_directory().
*/
function pluggable_node_access_ctools_plugin_directory($module, $plugin) {
if ($module == 'pluggable_node_access') {
return 'plugins/' . $plugin;
}
}
// /plugins/pluggable_node_access
/**
* Overrides \OgSelectionHandler::buildEntityFieldQuery
*/
public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::public function buildEntityFieldQuery($match, $match_operator);
$field_mode = $this->instance['field_mode'];
if ($field_mode == 'default') {
$query->fieldCondition('', array(),'IN');
}

which takes advantage of the $_ENV variable

/**
* Implements hook_watchdog().
*/
function example_user_watchdog(array $log_entry) {
if ($log_entry['message'] != 'Session opened for %name.') {
return;
}
logs_http_register_event($log_entry);
}