repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
goalgorilla/open_social
modules/custom/social_auth_extra/src/AuthSessionDataHandler.php
AuthSessionDataHandler.set
public function set($key, $value) { $this->session->set($this->sessionPrefix . $key, $value); }
php
public function set($key, $value) { $this->session->set($this->sessionPrefix . $key, $value); }
[ "public", "function", "set", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "session", "->", "set", "(", "$", "this", "->", "sessionPrefix", ".", "$", "key", ",", "$", "value", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_extra/src/AuthSessionDataHandler.php#L48-L50
goalgorilla/open_social
modules/social_features/social_event/src/Plugin/Block/EventAddBlock.php
EventAddBlock.blockAccess
protected function blockAccess(AccountInterface $account) { $route_user_id = $this->routeMatch->getParameter('user'); if ($account->id() == $route_user_id && $account->hasPermission("create event content")) { return AccessResult::allowed(); } // By default, the block is not visible. return Acc...
php
protected function blockAccess(AccountInterface $account) { $route_user_id = $this->routeMatch->getParameter('user'); if ($account->id() == $route_user_id && $account->hasPermission("create event content")) { return AccessResult::allowed(); } // By default, the block is not visible. return Acc...
[ "protected", "function", "blockAccess", "(", "AccountInterface", "$", "account", ")", "{", "$", "route_user_id", "=", "$", "this", "->", "routeMatch", "->", "getParameter", "(", "'user'", ")", ";", "if", "(", "$", "account", "->", "id", "(", ")", "==", "...
{@inheritdoc} Custom access logic to display the block only on current user Events page.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Plugin/Block/EventAddBlock.php#L65-L72
goalgorilla/open_social
modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php
SocialGroupTagsBlock.blockAccess
protected function blockAccess(AccountInterface $account) { // If tagging is off, deny access always. if (!$this->tagService->active() || !$this->tagService->groupActive()) { return AccessResult::forbidden(); } // Routes we don't want to display the tag block on. $ignore_routes = [ 'ent...
php
protected function blockAccess(AccountInterface $account) { // If tagging is off, deny access always. if (!$this->tagService->active() || !$this->tagService->groupActive()) { return AccessResult::forbidden(); } // Routes we don't want to display the tag block on. $ignore_routes = [ 'ent...
[ "protected", "function", "blockAccess", "(", "AccountInterface", "$", "account", ")", "{", "// If tagging is off, deny access always.", "if", "(", "!", "$", "this", "->", "tagService", "->", "active", "(", ")", "||", "!", "$", "this", "->", "tagService", "->", ...
{@inheritdoc} Logic to display the block in the sidebar.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php#L78-L111
goalgorilla/open_social
modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php
SocialGroupTagsBlock.getCacheTags
public function getCacheTags() { $cache_tags = parent::getCacheTags(); $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $cache_tags[] = 'group:' . $group->id(); } return $cache_tags; }
php
public function getCacheTags() { $cache_tags = parent::getCacheTags(); $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $cache_tags[] = 'group:' . $group->id(); } return $cache_tags; }
[ "public", "function", "getCacheTags", "(", ")", "{", "$", "cache_tags", "=", "parent", "::", "getCacheTags", "(", ")", ";", "$", "group", "=", "$", "this", "->", "routeMatch", "->", "getParameter", "(", "'group'", ")", ";", "if", "(", "$", "group", "in...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php#L116-L125
goalgorilla/open_social
modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php
SocialGroupTagsBlock.getCacheContexts
public function getCacheContexts() { $contexts = parent::getCacheContexts(); $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $contexts = Cache::mergeContexts($contexts, ['group']); } return $contexts; }
php
public function getCacheContexts() { $contexts = parent::getCacheContexts(); $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $contexts = Cache::mergeContexts($contexts, ['group']); } return $contexts; }
[ "public", "function", "getCacheContexts", "(", ")", "{", "$", "contexts", "=", "parent", "::", "getCacheContexts", "(", ")", ";", "$", "group", "=", "$", "this", "->", "routeMatch", "->", "getParameter", "(", "'group'", ")", ";", "if", "(", "$", "group",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php#L130-L139
goalgorilla/open_social
modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php
SocialGroupTagsBlock.build
public function build() { $build = []; $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $build['content']['#markup'] = social_tagging_process_tags($group); } return $build; }
php
public function build() { $build = []; $group = $this->routeMatch->getParameter('group'); if ($group instanceof GroupInterface) { $build['content']['#markup'] = social_tagging_process_tags($group); } return $build; }
[ "public", "function", "build", "(", ")", "{", "$", "build", "=", "[", "]", ";", "$", "group", "=", "$", "this", "->", "routeMatch", "->", "getParameter", "(", "'group'", ")", ";", "if", "(", "$", "group", "instanceof", "GroupInterface", ")", "{", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialGroupTagsBlock.php#L144-L154
goalgorilla/open_social
modules/custom/activity_logger/src/Plugin/QueueWorker/MessageQueueBase.php
MessageQueueBase.createQueueItem
protected function createQueueItem($queue_name, $data) { $queue = \Drupal::queue($queue_name); $queue->createItem($data); }
php
protected function createQueueItem($queue_name, $data) { $queue = \Drupal::queue($queue_name); $queue->createItem($data); }
[ "protected", "function", "createQueueItem", "(", "$", "queue_name", ",", "$", "data", ")", "{", "$", "queue", "=", "\\", "Drupal", "::", "queue", "(", "$", "queue_name", ")", ";", "$", "queue", "->", "createItem", "(", "$", "data", ")", ";", "}" ]
Simple reporter log and display information about the queue. @param string $queue_name The queue name. @param object $data The $data which should be stored in the queue item.
[ "Simple", "reporter", "log", "and", "display", "information", "about", "the", "queue", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Plugin/QueueWorker/MessageQueueBase.php#L20-L23
goalgorilla/open_social
modules/social_features/social_event/src/Plugin/views/sort/EventPassedDesc.php
EventPassedDesc.query
public function query() { $order = ($this->view->exposed_data["{$this->realField}_op"] == '>=') ? 'ASC' : 'DESC'; $this->query->addOrderBy($this->tableAlias, $this->realField, $order); }
php
public function query() { $order = ($this->view->exposed_data["{$this->realField}_op"] == '>=') ? 'ASC' : 'DESC'; $this->query->addOrderBy($this->tableAlias, $this->realField, $order); }
[ "public", "function", "query", "(", ")", "{", "$", "order", "=", "(", "$", "this", "->", "view", "->", "exposed_data", "[", "\"{$this->realField}_op\"", "]", "==", "'>='", ")", "?", "'ASC'", ":", "'DESC'", ";", "$", "this", "->", "query", "->", "addOrd...
Called to add the sort to a query.
[ "Called", "to", "add", "the", "sort", "to", "a", "query", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Plugin/views/sort/EventPassedDesc.php#L17-L20
goalgorilla/open_social
modules/social_features/social_content_report/src/Plugin/views/field/LinkReportClose.php
LinkReportClose.getUrlInfo
protected function getUrlInfo(ResultRow $row) { /** @var \Drupal\flag\FlaggingInterface $flagging */ $flagging = $this->getEntity($row); return Url::fromRoute('social_content_report.close_report', [ 'flagging' => $flagging->id(), ]); }
php
protected function getUrlInfo(ResultRow $row) { /** @var \Drupal\flag\FlaggingInterface $flagging */ $flagging = $this->getEntity($row); return Url::fromRoute('social_content_report.close_report', [ 'flagging' => $flagging->id(), ]); }
[ "protected", "function", "getUrlInfo", "(", "ResultRow", "$", "row", ")", "{", "/** @var \\Drupal\\flag\\FlaggingInterface $flagging */", "$", "flagging", "=", "$", "this", "->", "getEntity", "(", "$", "row", ")", ";", "return", "Url", "::", "fromRoute", "(", "'...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Plugin/views/field/LinkReportClose.php#L21-L28
goalgorilla/open_social
modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php
ActivityLoggerFactory.createMessages
public function createMessages(Entity $entity, $action) { // Get all messages that are responsible for creating items. $message_types = $this->getMessageTypes($action, $entity); // Loop through those message types and create messages. foreach ($message_types as $message_type => $message_values) { ...
php
public function createMessages(Entity $entity, $action) { // Get all messages that are responsible for creating items. $message_types = $this->getMessageTypes($action, $entity); // Loop through those message types and create messages. foreach ($message_types as $message_type => $message_values) { ...
[ "public", "function", "createMessages", "(", "Entity", "$", "entity", ",", "$", "action", ")", "{", "// Get all messages that are responsible for creating items.", "$", "message_types", "=", "$", "this", "->", "getMessageTypes", "(", "$", "action", ",", "$", "entity...
Create message entities. @param \Drupal\Core\Entity\Entity $entity Entity object to create a message for. @param string $action Action string. Defaults to 'create'.
[ "Create", "message", "entities", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php#L25-L85
goalgorilla/open_social
modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php
ActivityLoggerFactory.getMessageTypes
public function getMessageTypes($action, Entity $entity) { // Init. $messagetypes = []; // We need the entitytype manager. $entity_type_manager = \Drupal::service('entity_type.manager'); // Message type storage. $message_storage = $entity_type_manager->getStorage('message_template'); // Ch...
php
public function getMessageTypes($action, Entity $entity) { // Init. $messagetypes = []; // We need the entitytype manager. $entity_type_manager = \Drupal::service('entity_type.manager'); // Message type storage. $message_storage = $entity_type_manager->getStorage('message_template'); // Ch...
[ "public", "function", "getMessageTypes", "(", "$", "action", ",", "Entity", "$", "entity", ")", "{", "// Init.", "$", "messagetypes", "=", "[", "]", ";", "// We need the entitytype manager.", "$", "entity_type_manager", "=", "\\", "Drupal", "::", "service", "(",...
Get message templates for action and entity. @param string $action Action string, e.g. 'create'. @param \Drupal\Core\Entity\Entity $entity Entity object. @return array Array of message types.
[ "Get", "message", "templates", "for", "action", "and", "entity", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php#L98-L143
goalgorilla/open_social
modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php
ActivityLoggerFactory.createFieldInstances
protected function createFieldInstances($message_type, array $fields) { foreach ($fields as $field) { $id = 'message.' . $message_type . '.' . $field['name']; $config_storage = \Drupal::entityTypeManager() ->getStorage('field_config'); // Create field instances if they do not exists. ...
php
protected function createFieldInstances($message_type, array $fields) { foreach ($fields as $field) { $id = 'message.' . $message_type . '.' . $field['name']; $config_storage = \Drupal::entityTypeManager() ->getStorage('field_config'); // Create field instances if they do not exists. ...
[ "protected", "function", "createFieldInstances", "(", "$", "message_type", ",", "array", "$", "fields", ")", "{", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "$", "id", "=", "'message.'", ".", "$", "message_type", ".", "'.'", ".", "$", ...
Create field instances. @param string $message_type The typeof message. @param array $fields The data to insert in the field instances.
[ "Create", "field", "instances", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php#L153-L192
goalgorilla/open_social
modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php
ActivityLoggerFactory.checkIfMessageExist
public function checkIfMessageExist($message_type, $context, array $destination, array $related_object, $uid) { $exists = FALSE; $query = \Drupal::entityQuery('message'); $query->condition('template', $message_type); $query->condition('field_message_related_object.target_id', $related_object['target_id...
php
public function checkIfMessageExist($message_type, $context, array $destination, array $related_object, $uid) { $exists = FALSE; $query = \Drupal::entityQuery('message'); $query->condition('template', $message_type); $query->condition('field_message_related_object.target_id', $related_object['target_id...
[ "public", "function", "checkIfMessageExist", "(", "$", "message_type", ",", "$", "context", ",", "array", "$", "destination", ",", "array", "$", "related_object", ",", "$", "uid", ")", "{", "$", "exists", "=", "FALSE", ";", "$", "query", "=", "\\", "Drup...
Checks if a message already exists. @param string $message_type The message type. @param string $context The context of the message. @param array $destination The array of destinations to check for, include delta as well. @param array $related_object The related object, include target_type and target_id in array. @par...
[ "Checks", "if", "a", "message", "already", "exists", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Service/ActivityLoggerFactory.php#L211-L253
goalgorilla/open_social
modules/custom/download_count/src/Plugin/Field/FieldFormatter/FieldDownloadCount.php
FieldDownloadCount.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { $element = []; $entity = $items->getEntity(); $entity_type = $entity->getEntityTypeId(); $access = \Drupal::currentUser()->hasPermission('view download counts'); foreach ($this->getEntitiesToView($items, $langcode) as $delta =...
php
public function viewElements(FieldItemListInterface $items, $langcode) { $element = []; $entity = $items->getEntity(); $entity_type = $entity->getEntityTypeId(); $access = \Drupal::currentUser()->hasPermission('view download counts'); foreach ($this->getEntitiesToView($items, $langcode) as $delta =...
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "$", "element", "=", "[", "]", ";", "$", "entity", "=", "$", "items", "->", "getEntity", "(", ")", ";", "$", "entity_type", "=", "$", "en...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/download_count/src/Plugin/Field/FieldFormatter/FieldDownloadCount.php#L27-L177
goalgorilla/open_social
modules/custom/mentions/src/EventSubscriber/MentionsDelete.php
MentionsDelete.onMentionsDelete
public function onMentionsDelete($event) { $config = \Drupal::config('mentions.mentions'); $config_mentions_events = $config->get('mentions_events'); $action_id = $config_mentions_events['delete']; if (empty($action_id)) { return; } $entity_storage = \Drupal::entityManager()->getStorage('a...
php
public function onMentionsDelete($event) { $config = \Drupal::config('mentions.mentions'); $config_mentions_events = $config->get('mentions_events'); $action_id = $config_mentions_events['delete']; if (empty($action_id)) { return; } $entity_storage = \Drupal::entityManager()->getStorage('a...
[ "public", "function", "onMentionsDelete", "(", "$", "event", ")", "{", "$", "config", "=", "\\", "Drupal", "::", "config", "(", "'mentions.mentions'", ")", ";", "$", "config_mentions_events", "=", "$", "config", "->", "get", "(", "'mentions_events'", ")", ";...
Event handler.
[ "Event", "handler", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/EventSubscriber/MentionsDelete.php#L24-L37
goalgorilla/open_social
modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php
TwitterAuthController.getProfile
public function getProfile($type) { $sdk = $this->getSdk($type); $data_handler = $this->networkManager->createInstance('social_auth_twitter')->getDataHandler(); // Get the OAuth token from Twitter. if (!($oauth_token = $data_handler->get('oauth_token')) || !($oauth_token_secret = $data_handler->get('oa...
php
public function getProfile($type) { $sdk = $this->getSdk($type); $data_handler = $this->networkManager->createInstance('social_auth_twitter')->getDataHandler(); // Get the OAuth token from Twitter. if (!($oauth_token = $data_handler->get('oauth_token')) || !($oauth_token_secret = $data_handler->get('oa...
[ "public", "function", "getProfile", "(", "$", "type", ")", "{", "$", "sdk", "=", "$", "this", "->", "getSdk", "(", "$", "type", ")", ";", "$", "data_handler", "=", "$", "this", "->", "networkManager", "->", "createInstance", "(", "'social_auth_twitter'", ...
Loads access token, then loads profile. @param string $type The type. @return object Returns an object.
[ "Loads", "access", "token", "then", "loads", "profile", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_twitter/src/Controller/TwitterAuthController.php#L261-L297
goalgorilla/open_social
modules/custom/social_language/src/Routing/RouteSubscriber.php
RouteSubscriber.alterRoutes
protected function alterRoutes(RouteCollection $collection) { // Set custom permissions for account email & site information & menu items // translation pages. $routes = [ 'translate system information' => [ 'config_translation.item.add.system.site_information_settings', 'config_trans...
php
protected function alterRoutes(RouteCollection $collection) { // Set custom permissions for account email & site information & menu items // translation pages. $routes = [ 'translate system information' => [ 'config_translation.item.add.system.site_information_settings', 'config_trans...
[ "protected", "function", "alterRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "// Set custom permissions for account email & site information & menu items", "// translation pages.", "$", "routes", "=", "[", "'translate system information'", "=>", "[", "'config_tran...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_language/src/Routing/RouteSubscriber.php#L20-L56
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php
LinkedInAuthManager.getAuthenticationUrl
public function getAuthenticationUrl($type, array $scope = ['r_basicprofile', 'r_emailaddress']) { return $this->sdk->getLoginUrl([ 'redirect_uri' => $this->getRedirectUrl($type), 'scope' => implode(',', $scope), ]); }
php
public function getAuthenticationUrl($type, array $scope = ['r_basicprofile', 'r_emailaddress']) { return $this->sdk->getLoginUrl([ 'redirect_uri' => $this->getRedirectUrl($type), 'scope' => implode(',', $scope), ]); }
[ "public", "function", "getAuthenticationUrl", "(", "$", "type", ",", "array", "$", "scope", "=", "[", "'r_basicprofile'", ",", "'r_emailaddress'", "]", ")", "{", "return", "$", "this", "->", "sdk", "->", "getLoginUrl", "(", "[", "'redirect_uri'", "=>", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php#L39-L44
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php
LinkedInAuthManager.getAccessToken
public function getAccessToken($type = '') { try { $access_token = $this->sdk->getAccessToken(); return $access_token; } catch (LinkedInException $e) { $this->loggerFactory ->get('social_auth_linkedin') ->error('Could not get LinkedIn access token. LinkedInException: @messa...
php
public function getAccessToken($type = '') { try { $access_token = $this->sdk->getAccessToken(); return $access_token; } catch (LinkedInException $e) { $this->loggerFactory ->get('social_auth_linkedin') ->error('Could not get LinkedIn access token. LinkedInException: @messa...
[ "public", "function", "getAccessToken", "(", "$", "type", "=", "''", ")", "{", "try", "{", "$", "access_token", "=", "$", "this", "->", "sdk", "->", "getAccessToken", "(", ")", ";", "return", "$", "access_token", ";", "}", "catch", "(", "LinkedInExceptio...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php#L49-L73
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php
LinkedInAuthManager.getProfile
public function getProfile() { if (!$this->profile) { if (($profile = $this->sdk->get('v1/people/~:(id,firstName,lastName,email-address,formattedName,pictureUrls::(original))')) && !isset($profile['errorCode'])) { $this->profile = $profile; } } return $this->profile; }
php
public function getProfile() { if (!$this->profile) { if (($profile = $this->sdk->get('v1/people/~:(id,firstName,lastName,email-address,formattedName,pictureUrls::(original))')) && !isset($profile['errorCode'])) { $this->profile = $profile; } } return $this->profile; }
[ "public", "function", "getProfile", "(", ")", "{", "if", "(", "!", "$", "this", "->", "profile", ")", "{", "if", "(", "(", "$", "profile", "=", "$", "this", "->", "sdk", "->", "get", "(", "'v1/people/~:(id,firstName,lastName,email-address,formattedName,picture...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/LinkedInAuthManager.php#L78-L86
goalgorilla/open_social
modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php
ReportContentType.render
public function render(ResultRow $row) { /** @var \Drupal\flag\FlaggingInterface $flagging */ $flagging = $this ->getEntity($row); $reported_entity = $flagging->getFlaggable(); if ($reported_entity->getEntityTypeId() === 'node') { /** @var \Drupal\node\NodeInterface $reported_entity */ ...
php
public function render(ResultRow $row) { /** @var \Drupal\flag\FlaggingInterface $flagging */ $flagging = $this ->getEntity($row); $reported_entity = $flagging->getFlaggable(); if ($reported_entity->getEntityTypeId() === 'node') { /** @var \Drupal\node\NodeInterface $reported_entity */ ...
[ "public", "function", "render", "(", "ResultRow", "$", "row", ")", "{", "/** @var \\Drupal\\flag\\FlaggingInterface $flagging */", "$", "flagging", "=", "$", "this", "->", "getEntity", "(", "$", "row", ")", ";", "$", "reported_entity", "=", "$", "flagging", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php#L25-L38
goalgorilla/open_social
modules/custom/social_language/src/SocialLanguageConfigOverride.php
SocialLanguageConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Override user form display. $config_name = 'core.entity_form_display.user.user.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable($config_name)...
php
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Override user form display. $config_name = 'core.entity_form_display.user.user.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable($config_name)...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_factory", "=", "\\", "Drupal", "::", "service", "(", "'config.factory'", ")", ";", "// Override user form display.", "$", "config_name", "=",...
Load overrides.
[ "Load", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_language/src/SocialLanguageConfigOverride.php#L19-L56
goalgorilla/open_social
modules/social_features/social_tagging/src/SocialTaggingService.php
SocialTaggingService.hasContent
public function hasContent() { if (count($this->getCategories()) == 0) { return FALSE; } if (count($this->getAllChildren()) == 0) { return FALSE; } return TRUE; }
php
public function hasContent() { if (count($this->getCategories()) == 0) { return FALSE; } if (count($this->getAllChildren()) == 0) { return FALSE; } return TRUE; }
[ "public", "function", "hasContent", "(", ")", "{", "if", "(", "count", "(", "$", "this", "->", "getCategories", "(", ")", ")", "==", "0", ")", "{", "return", "FALSE", ";", "}", "if", "(", "count", "(", "$", "this", "->", "getAllChildren", "(", ")",...
Returns if there are any taxonomy items available. @return bool If there are tags available.
[ "Returns", "if", "there", "are", "any", "taxonomy", "items", "available", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/SocialTaggingService.php#L71-L82
goalgorilla/open_social
modules/social_features/social_tagging/src/SocialTaggingService.php
SocialTaggingService.getCategories
public function getCategories() { // Define as array. $options = []; // Fetch main categories. foreach ($this->termStorage->loadTree('social_tagging', 0, 1) as $category) { $options[$category->tid] = $category->name; } // Return array. return $options; }
php
public function getCategories() { // Define as array. $options = []; // Fetch main categories. foreach ($this->termStorage->loadTree('social_tagging', 0, 1) as $category) { $options[$category->tid] = $category->name; } // Return array. return $options; }
[ "public", "function", "getCategories", "(", ")", "{", "// Define as array.", "$", "options", "=", "[", "]", ";", "// Fetch main categories.", "foreach", "(", "$", "this", "->", "termStorage", "->", "loadTree", "(", "'social_tagging'", ",", "0", ",", "1", ")", ...
Returns all the top level term items, that are considered categories. @return array An array of top level category items.
[ "Returns", "all", "the", "top", "level", "term", "items", "that", "are", "considered", "categories", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/SocialTaggingService.php#L100-L109
goalgorilla/open_social
modules/social_features/social_tagging/src/SocialTaggingService.php
SocialTaggingService.getAllChildren
public function getAllChildren() { // Define as array. $options = []; // Fetch main categories. foreach (array_keys($this->getCategories()) as $category) { $options = array_merge($options, $this->getChildren($category)); } // Return array. return $options; }
php
public function getAllChildren() { // Define as array. $options = []; // Fetch main categories. foreach (array_keys($this->getCategories()) as $category) { $options = array_merge($options, $this->getChildren($category)); } // Return array. return $options; }
[ "public", "function", "getAllChildren", "(", ")", "{", "// Define as array.", "$", "options", "=", "[", "]", ";", "// Fetch main categories.", "foreach", "(", "array_keys", "(", "$", "this", "->", "getCategories", "(", ")", ")", "as", "$", "category", ")", "...
Returns all the children of top level term items. @return array An array of child items.
[ "Returns", "all", "the", "children", "of", "top", "level", "term", "items", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/SocialTaggingService.php#L137-L147
goalgorilla/open_social
modules/social_features/social_tagging/src/SocialTaggingService.php
SocialTaggingService.buildHierarchy
public function buildHierarchy(array $terms, $entity_type) { $tree = []; foreach ($terms as $term) { if (!isset($term['target_id'])) { continue; } $current_term = $this->termStorage->load($term['target_id']); // Must be a valid Term. if (!$current_term instanceof TermInt...
php
public function buildHierarchy(array $terms, $entity_type) { $tree = []; foreach ($terms as $term) { if (!isset($term['target_id'])) { continue; } $current_term = $this->termStorage->load($term['target_id']); // Must be a valid Term. if (!$current_term instanceof TermInt...
[ "public", "function", "buildHierarchy", "(", "array", "$", "terms", ",", "$", "entity_type", ")", "{", "$", "tree", "=", "[", "]", ";", "foreach", "(", "$", "terms", "as", "$", "term", ")", "{", "if", "(", "!", "isset", "(", "$", "term", "[", "'t...
Returns a multilevel tree. @param array $terms An array of items that are selected. @param string $entity_type The entity type these tags are for. @return array An hierarchy array of items with their parent.
[ "Returns", "a", "multilevel", "tree", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/SocialTaggingService.php#L160-L201
goalgorilla/open_social
modules/social_features/social_follow_content/src/Plugin/ActivityContext/FollowContentActivityContext.php
FollowContentActivityContext.getRecipientsWhoFollowContent
public function getRecipientsWhoFollowContent(array $related_entity, array $data) { $recipients = []; $storage = \Drupal::entityTypeManager()->getStorage('flagging'); $flaggings = $storage->loadByProperties([ 'flag_id' => 'follow_content', 'entity_type' => $related_entity['target_type'], ...
php
public function getRecipientsWhoFollowContent(array $related_entity, array $data) { $recipients = []; $storage = \Drupal::entityTypeManager()->getStorage('flagging'); $flaggings = $storage->loadByProperties([ 'flag_id' => 'follow_content', 'entity_type' => $related_entity['target_type'], ...
[ "public", "function", "getRecipientsWhoFollowContent", "(", "array", "$", "related_entity", ",", "array", "$", "data", ")", "{", "$", "recipients", "=", "[", "]", ";", "$", "storage", "=", "\\", "Drupal", "::", "entityTypeManager", "(", ")", "->", "getStorag...
Returns owner recipient from entity.
[ "Returns", "owner", "recipient", "from", "entity", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_follow_content/src/Plugin/ActivityContext/FollowContentActivityContext.php#L39-L68
goalgorilla/open_social
modules/custom/activity_viewer/src/Plugin/views/row/ActivityRow.php
ActivityRow.preRender
public function preRender($result) { $view_mode = $this->options['view_mode']; if ($result) { // TODO: Move all this logic to a service. // TODO: Change this to use dependency injection. /* @var $plugin \Drupal\activity_creator\Plugin\ActivityDestinationManager */ $destination_plugin_m...
php
public function preRender($result) { $view_mode = $this->options['view_mode']; if ($result) { // TODO: Move all this logic to a service. // TODO: Change this to use dependency injection. /* @var $plugin \Drupal\activity_creator\Plugin\ActivityDestinationManager */ $destination_plugin_m...
[ "public", "function", "preRender", "(", "$", "result", ")", "{", "$", "view_mode", "=", "$", "this", "->", "options", "[", "'view_mode'", "]", ";", "if", "(", "$", "result", ")", "{", "// TODO: Move all this logic to a service.", "// TODO: Change this to use depen...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_viewer/src/Plugin/views/row/ActivityRow.php#L21-L48
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/PageTitle.php
PageTitle.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Get the current path and if is it stream return a variable. $current_url = Url::fromRoute('<current>'); $current_path = $current_url->toString(); $route_name = \Drupal::routeMatch()-...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Get the current path and if is it stream return a variable. $current_url = Url::fromRoute('<current>'); $current_path = $current_url->toString(); $route_name = \Drupal::routeMatch()-...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// Get the current path an...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/PageTitle.php#L20-L61
goalgorilla/open_social
modules/social_features/social_profile/src/SocialProfileTrait.php
SocialProfileTrait.getUserIdsFromName
public function getUserIdsFromName($name, $count, $suggestion_format = SOCIAL_PROFILE_SUGGESTIONS_ALL) { $query = $this->startQuery(); $name = '%' . ltrim($query->escapeLike($name)) . '%'; switch ($suggestion_format) { case SOCIAL_PROFILE_SUGGESTIONS_USERNAME: $query->condition('uf.name', $na...
php
public function getUserIdsFromName($name, $count, $suggestion_format = SOCIAL_PROFILE_SUGGESTIONS_ALL) { $query = $this->startQuery(); $name = '%' . ltrim($query->escapeLike($name)) . '%'; switch ($suggestion_format) { case SOCIAL_PROFILE_SUGGESTIONS_USERNAME: $query->condition('uf.name', $na...
[ "public", "function", "getUserIdsFromName", "(", "$", "name", ",", "$", "count", ",", "$", "suggestion_format", "=", "SOCIAL_PROFILE_SUGGESTIONS_ALL", ")", "{", "$", "query", "=", "$", "this", "->", "startQuery", "(", ")", ";", "$", "name", "=", "'%'", "."...
Get a list of account IDs whose account names begin with the given string. @param string $name The string to search for. @param int $count The number of results to return. @param string $suggestion_format (optional) The suggestion format. @return int[] An array of account IDs for accounts whose account names begin wi...
[ "Get", "a", "list", "of", "account", "IDs", "whose", "account", "names", "begin", "with", "the", "given", "string", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/SocialProfileTrait.php#L51-L108
goalgorilla/open_social
modules/social_features/social_profile/src/SocialProfileTrait.php
SocialProfileTrait.startQuery
private function startQuery() { $connection = \Drupal::database(); $query = $connection->select('users', 'u')->fields('u', ['uid']); $query->join('users_field_data', 'uf', 'uf.uid = u.uid'); $query->leftJoin('profile', 'p', 'p.uid = u.uid'); if ($this->useFullName()) { $query->leftJoin('prof...
php
private function startQuery() { $connection = \Drupal::database(); $query = $connection->select('users', 'u')->fields('u', ['uid']); $query->join('users_field_data', 'uf', 'uf.uid = u.uid'); $query->leftJoin('profile', 'p', 'p.uid = u.uid'); if ($this->useFullName()) { $query->leftJoin('prof...
[ "private", "function", "startQuery", "(", ")", "{", "$", "connection", "=", "\\", "Drupal", "::", "database", "(", ")", ";", "$", "query", "=", "$", "connection", "->", "select", "(", "'users'", ",", "'u'", ")", "->", "fields", "(", "'u'", ",", "[", ...
Start a Social Profile Mention Query. @return \Drupal\Core\Database\Query\SelectInterface Returns the query object.
[ "Start", "a", "Social", "Profile", "Mention", "Query", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/SocialProfileTrait.php#L116-L135
goalgorilla/open_social
modules/social_features/social_profile/src/SocialProfileTrait.php
SocialProfileTrait.sortQuery
private function sortQuery(SelectInterface $query, $name, $suggestion_format) { if ($suggestion_format !== SOCIAL_PROFILE_SUGGESTIONS_USERNAME && $this->useFullName()) { // Delete percent symbol on the beginning of the phrase for search from // the start of field values. $name = substr($name, 1); ...
php
private function sortQuery(SelectInterface $query, $name, $suggestion_format) { if ($suggestion_format !== SOCIAL_PROFILE_SUGGESTIONS_USERNAME && $this->useFullName()) { // Delete percent symbol on the beginning of the phrase for search from // the start of field values. $name = substr($name, 1); ...
[ "private", "function", "sortQuery", "(", "SelectInterface", "$", "query", ",", "$", "name", ",", "$", "suggestion_format", ")", "{", "if", "(", "$", "suggestion_format", "!==", "SOCIAL_PROFILE_SUGGESTIONS_USERNAME", "&&", "$", "this", "->", "useFullName", "(", "...
Sorts the query. Following the rules: 1. Users whose have first name starting by the given string; 2. Users whose have last name starting by the given string; 3. Users whose have nickname starting by the given string; 4. Users whose have username starting by the given string; 5. Users containing the string. @param \...
[ "Sorts", "the", "query", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/SocialProfileTrait.php#L157-L181
goalgorilla/open_social
modules/social_features/social_profile/src/SocialProfileTrait.php
SocialProfileTrait.endQuery
private function endQuery(SelectInterface $query, $count) { $result = $query ->range(0, $count) ->execute() ->fetchCol(); return !empty($result) ? $result : []; }
php
private function endQuery(SelectInterface $query, $count) { $result = $query ->range(0, $count) ->execute() ->fetchCol(); return !empty($result) ? $result : []; }
[ "private", "function", "endQuery", "(", "SelectInterface", "$", "query", ",", "$", "count", ")", "{", "$", "result", "=", "$", "query", "->", "range", "(", "0", ",", "$", "count", ")", "->", "execute", "(", ")", "->", "fetchCol", "(", ")", ";", "re...
End a Social Profile Mention Query. @return int[] An array of account IDs for accounts whose account names begin with the given string.
[ "End", "a", "Social", "Profile", "Mention", "Query", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/SocialProfileTrait.php#L190-L197
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_managers/src/Element/SocialEnrollmentAutocomplete.php
SocialEnrollmentAutocomplete.validateEntityAutocomplete
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { $duplicated_values = $value = []; // Load the current Event enrollments so we can check duplicates. $storage = \Drupal::entityTypeManager()->getStorage('event_enrollment'); if (e...
php
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { $duplicated_values = $value = []; // Load the current Event enrollments so we can check duplicates. $storage = \Drupal::entityTypeManager()->getStorage('event_enrollment'); if (e...
[ "public", "static", "function", "validateEntityAutocomplete", "(", "array", "&", "$", "element", ",", "FormStateInterface", "$", "form_state", ",", "array", "&", "$", "complete_form", ")", "{", "$", "duplicated_values", "=", "$", "value", "=", "[", "]", ";", ...
Form element validation handler for entity_autocomplete elements.
[ "Form", "element", "validation", "handler", "for", "entity_autocomplete", "elements", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_managers/src/Element/SocialEnrollmentAutocomplete.php#L24-L103
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/FileLink.php
FileLink.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Find out what the active theme is first. $theme = \Drupal::theme()->getActiveTheme(); // Check if socialbase is one of the base themes. // Then get the path to socialbase theme and ...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Find out what the active theme is first. $theme = \Drupal::theme()->getActiveTheme(); // Check if socialbase is one of the base themes. // Then get the path to socialbase theme and ...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// Find out what the activ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/FileLink.php#L22-L87
goalgorilla/open_social
modules/social_features/social_like/src/SocialLikeConfigOverride.php
SocialLikeConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; // Override post photo default. $config_names = [ 'core.entity_view_display.post.photo.activity', 'core.entity_view_display.post.photo.default', ]; foreach ($config_names as $config_name) { if (in_array($config_name, $names...
php
public function loadOverrides($names) { $overrides = []; // Override post photo default. $config_names = [ 'core.entity_view_display.post.photo.activity', 'core.entity_view_display.post.photo.default', ]; foreach ($config_names as $config_name) { if (in_array($config_name, $names...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "// Override post photo default.", "$", "config_names", "=", "[", "'core.entity_view_display.post.photo.activity'", ",", "'core.entity_view_display.post.photo.default'"...
Returns config overrides.
[ "Returns", "config", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_like/src/SocialLikeConfigOverride.php#L21-L45
goalgorilla/open_social
modules/social_features/social_core/src/Controller/EntityAutocompleteController.php
EntityAutocompleteController.handleAutocomplete
public function handleAutocomplete(Request $request, $target_type, $selection_handler, $selection_settings_key) { $matches = []; // Get the typed string from the URL, if it exists. if ($input = $request->query->get('q')) { $typed_string = Tags::explode($input); $typed_string = Unicode::strtolowe...
php
public function handleAutocomplete(Request $request, $target_type, $selection_handler, $selection_settings_key) { $matches = []; // Get the typed string from the URL, if it exists. if ($input = $request->query->get('q')) { $typed_string = Tags::explode($input); $typed_string = Unicode::strtolowe...
[ "public", "function", "handleAutocomplete", "(", "Request", "$", "request", ",", "$", "target_type", ",", "$", "selection_handler", ",", "$", "selection_settings_key", ")", "{", "$", "matches", "=", "[", "]", ";", "// Get the typed string from the URL, if it exists.",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/Controller/EntityAutocompleteController.php#L24-L54
goalgorilla/open_social
modules/custom/social_auth_extra/src/Form/AuthUnlinkForm.php
AuthUnlinkForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { $account = User::load($this->currentUser()->id()); $network_manager = \Drupal::service('plugin.network.manager'); $is_connected = FALSE; foreach ($network_manager->getDefinitions() as $definition) { /** @var \Drupal\social...
php
public function submitForm(array &$form, FormStateInterface $form_state) { $account = User::load($this->currentUser()->id()); $network_manager = \Drupal::service('plugin.network.manager'); $is_connected = FALSE; foreach ($network_manager->getDefinitions() as $definition) { /** @var \Drupal\social...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "account", "=", "User", "::", "load", "(", "$", "this", "->", "currentUser", "(", ")", "->", "id", "(", ")", ")", ";", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_extra/src/Form/AuthUnlinkForm.php#L68-L105
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.create
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { $entity_manager = $container->get('entity.manager'); $renderer = $container->get('renderer'); $config = $container->get('config.factory'); $mentions_manager = $container->get('plugin.mana...
php
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { $entity_manager = $container->get('entity.manager'); $renderer = $container->get('renderer'); $config = $container->get('config.factory'); $mentions_manager = $container->get('plugin.mana...
[ "public", "static", "function", "create", "(", "ContainerInterface", "$", "container", ",", "array", "$", "configuration", ",", "$", "plugin_id", ",", "$", "plugin_definition", ")", "{", "$", "entity_manager", "=", "$", "container", "->", "get", "(", "'entity....
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L70-L88
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.checkMentionTypes
public function checkMentionTypes() { $settings = $this->settings; if (isset($settings['mentions_filter'])) { $configs = $this->config->listAll('mentions.mentions_type'); foreach ($configs as $config) { $this->mentionTypes[] = str_replace('mentions.mentions_type.', '', $config); } ...
php
public function checkMentionTypes() { $settings = $this->settings; if (isset($settings['mentions_filter'])) { $configs = $this->config->listAll('mentions.mentions_type'); foreach ($configs as $config) { $this->mentionTypes[] = str_replace('mentions.mentions_type.', '', $config); } ...
[ "public", "function", "checkMentionTypes", "(", ")", "{", "$", "settings", "=", "$", "this", "->", "settings", ";", "if", "(", "isset", "(", "$", "settings", "[", "'mentions_filter'", "]", ")", ")", "{", "$", "configs", "=", "$", "this", "->", "config"...
Checks if there are mentionTypes. @return bool TRUE if there are mentionTypes, otherwise FALSE.
[ "Checks", "if", "there", "are", "mentionTypes", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L106-L118
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.shouldApplyFilter
public function shouldApplyFilter() { if ($this->checkMentionTypes()) { return TRUE; } elseif ($this->textFormat && ($format = FilterFormat::load($this->textFormat))) { $filters = $format->get('filters'); if (!empty($filters['filter_mentions']['status'])) { $this->settings = $filt...
php
public function shouldApplyFilter() { if ($this->checkMentionTypes()) { return TRUE; } elseif ($this->textFormat && ($format = FilterFormat::load($this->textFormat))) { $filters = $format->get('filters'); if (!empty($filters['filter_mentions']['status'])) { $this->settings = $filt...
[ "public", "function", "shouldApplyFilter", "(", ")", "{", "if", "(", "$", "this", "->", "checkMentionTypes", "(", ")", ")", "{", "return", "TRUE", ";", "}", "elseif", "(", "$", "this", "->", "textFormat", "&&", "(", "$", "format", "=", "FilterFormat", ...
Checks if a textFormat filter should be applied. @return bool TRUE if filter should applied, otherwise FALSE.
[ "Checks", "if", "a", "textFormat", "filter", "should", "be", "applied", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L126-L141
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.getMentions
public function getMentions($text) { $mentions = []; $config_names = $this->mentionTypes; foreach ($config_names as $config_name) { $settings = $this->config->get('mentions.mentions_type.' . $config_name); $input_settings = [ 'prefix' => $settings->get('input.prefix'), 'suffix' ...
php
public function getMentions($text) { $mentions = []; $config_names = $this->mentionTypes; foreach ($config_names as $config_name) { $settings = $this->config->get('mentions.mentions_type.' . $config_name); $input_settings = [ 'prefix' => $settings->get('input.prefix'), 'suffix' ...
[ "public", "function", "getMentions", "(", "$", "text", ")", "{", "$", "mentions", "=", "[", "]", ";", "$", "config_names", "=", "$", "this", "->", "mentionTypes", ";", "foreach", "(", "$", "config_names", "as", "$", "config_name", ")", "{", "$", "setti...
Gets the mentions in text. @param string $text The text to find mentions in. @return array A list of mentions.
[ "Gets", "the", "mentions", "in", "text", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L152-L202
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.filterMentions
public function filterMentions($text) { $mentions = $this->getMentions($text); foreach ($mentions as $match) { $mention = $this->mentionsManager->createInstance($match['type']); if ($mention instanceof MentionsPluginInterface) { $output_settings = $this->outputSettings[$match['config_name'...
php
public function filterMentions($text) { $mentions = $this->getMentions($text); foreach ($mentions as $match) { $mention = $this->mentionsManager->createInstance($match['type']); if ($mention instanceof MentionsPluginInterface) { $output_settings = $this->outputSettings[$match['config_name'...
[ "public", "function", "filterMentions", "(", "$", "text", ")", "{", "$", "mentions", "=", "$", "this", "->", "getMentions", "(", "$", "text", ")", ";", "foreach", "(", "$", "mentions", "as", "$", "match", ")", "{", "$", "mention", "=", "$", "this", ...
Filters mentions in a text. @param string $text The text containing the possible mentions. @return string The processed text.
[ "Filters", "mentions", "in", "a", "text", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L213-L235
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.process
public function process($text, $langcode) { if ($this->shouldApplyFilter()) { $text = $this->filterMentions($text); return new FilterProcessResult($text); } return new FilterProcessResult($text); }
php
public function process($text, $langcode) { if ($this->shouldApplyFilter()) { $text = $this->filterMentions($text); return new FilterProcessResult($text); } return new FilterProcessResult($text); }
[ "public", "function", "process", "(", "$", "text", ",", "$", "langcode", ")", "{", "if", "(", "$", "this", "->", "shouldApplyFilter", "(", ")", ")", "{", "$", "text", "=", "$", "this", "->", "filterMentions", "(", "$", "text", ")", ";", "return", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L240-L248
goalgorilla/open_social
modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php
MentionsFilter.settingsForm
public function settingsForm(array $form, FormStateInterface $form_state) { $configs = $this->config->listAll('mentions.mentions_type'); $candidate_entitytypes = []; foreach ($configs as $config) { $mentions_name = str_replace('mentions.mentions_type.', '', $config); $candidate_entitytypes[$men...
php
public function settingsForm(array $form, FormStateInterface $form_state) { $configs = $this->config->listAll('mentions.mentions_type'); $candidate_entitytypes = []; foreach ($configs as $config) { $mentions_name = str_replace('mentions.mentions_type.', '', $config); $candidate_entitytypes[$men...
[ "public", "function", "settingsForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "configs", "=", "$", "this", "->", "config", "->", "listAll", "(", "'mentions.mentions_type'", ")", ";", "$", "candidate_entitytypes", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php#L253-L274
goalgorilla/open_social
modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/ModulesInstalled.php
ModulesInstalled.getValue
public function getValue() { $value = []; $modules = \Drupal::service('extension.list.module')->reset()->getList(); $modules = $this->getExtensionsInfo($modules); $theme_data = \Drupal::service('theme_handler')->rebuildThemeData(); $themes = $this->getExtensionsInfo($theme_data); $profiles = \Dr...
php
public function getValue() { $value = []; $modules = \Drupal::service('extension.list.module')->reset()->getList(); $modules = $this->getExtensionsInfo($modules); $theme_data = \Drupal::service('theme_handler')->rebuildThemeData(); $themes = $this->getExtensionsInfo($theme_data); $profiles = \Dr...
[ "public", "function", "getValue", "(", ")", "{", "$", "value", "=", "[", "]", ";", "$", "modules", "=", "\\", "Drupal", "::", "service", "(", "'extension.list.module'", ")", "->", "reset", "(", ")", "->", "getList", "(", ")", ";", "$", "modules", "="...
Get the value. @return array $json array.
[ "Get", "the", "value", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/ModulesInstalled.php#L25-L42
goalgorilla/open_social
modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/ModulesInstalled.php
ModulesInstalled.getExtensionsInfo
private function getExtensionsInfo(array $projects) { $value = []; uasort($projects, 'system_sort_modules_by_info_name'); /** @var \Drupal\Core\Extension\Extension $project */ foreach ($projects as $project) { $name = $project->getName(); $info = $project->info; unset($info['dependenci...
php
private function getExtensionsInfo(array $projects) { $value = []; uasort($projects, 'system_sort_modules_by_info_name'); /** @var \Drupal\Core\Extension\Extension $project */ foreach ($projects as $project) { $name = $project->getName(); $info = $project->info; unset($info['dependenci...
[ "private", "function", "getExtensionsInfo", "(", "array", "$", "projects", ")", "{", "$", "value", "=", "[", "]", ";", "uasort", "(", "$", "projects", ",", "'system_sort_modules_by_info_name'", ")", ";", "/** @var \\Drupal\\Core\\Extension\\Extension $project */", "fo...
Get safe extensions info. @param \Drupal\Core\Extension\Extension[] $projects An array of extensions. @return array Returns an array of projects with safe values.
[ "Get", "safe", "extensions", "info", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/ModulesInstalled.php#L53-L70
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/BookNavigation.php
BookNavigation.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Disables the menu tree below the content on a // book node in full display mode. $variables['tree'] = ''; }
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Disables the menu tree below the content on a // book node in full display mode. $variables['tree'] = ''; }
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// Disables the menu tree ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/BookNavigation.php#L19-L25
goalgorilla/open_social
modules/social_features/social_private_message/src/Element/SocialPrivateMessageEntityAutocomplete.php
SocialPrivateMessageEntityAutocomplete.validateEntityAutocomplete
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { parent::validateEntityAutocomplete($element, $form_state, $complete_form); $value = $form_state->getValue('members'); $form_state->setValue('members', $value['target_id']); }
php
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { parent::validateEntityAutocomplete($element, $form_state, $complete_form); $value = $form_state->getValue('members'); $form_state->setValue('members', $value['target_id']); }
[ "public", "static", "function", "validateEntityAutocomplete", "(", "array", "&", "$", "element", ",", "FormStateInterface", "$", "form_state", ",", "array", "&", "$", "complete_form", ")", "{", "parent", "::", "validateEntityAutocomplete", "(", "$", "element", ","...
Form element validation handler for entity_autocomplete elements.
[ "Form", "element", "validation", "handler", "for", "entity_autocomplete", "elements", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Element/SocialPrivateMessageEntityAutocomplete.php#L21-L26
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/PrivateMessageMailer.php
PrivateMessageMailer.send
public function send(PrivateMessageInterface $message, PrivateMessageThreadInterface $thread, array $members = []) { foreach ($members as $id => $member) { if (!($member instanceof UserInterface)) { unset($members[$id]); } } parent::send($message, $thread, $members); }
php
public function send(PrivateMessageInterface $message, PrivateMessageThreadInterface $thread, array $members = []) { foreach ($members as $id => $member) { if (!($member instanceof UserInterface)) { unset($members[$id]); } } parent::send($message, $thread, $members); }
[ "public", "function", "send", "(", "PrivateMessageInterface", "$", "message", ",", "PrivateMessageThreadInterface", "$", "thread", ",", "array", "$", "members", "=", "[", "]", ")", "{", "foreach", "(", "$", "members", "as", "$", "id", "=>", "$", "member", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/PrivateMessageMailer.php#L18-L26
goalgorilla/open_social
modules/social_features/social_event/src/Entity/EventEnrollmentViewsData.php
EventEnrollmentViewsData.getViewsData
public function getViewsData() { $data = parent::getViewsData(); $data['event_enrollment_field_data']['table']['base'] = [ 'field' => 'id', 'title' => $this->t('Event enrollment'), 'help' => $this->t('The Event enrollment ID.'), ]; return $data; }
php
public function getViewsData() { $data = parent::getViewsData(); $data['event_enrollment_field_data']['table']['base'] = [ 'field' => 'id', 'title' => $this->t('Event enrollment'), 'help' => $this->t('The Event enrollment ID.'), ]; return $data; }
[ "public", "function", "getViewsData", "(", ")", "{", "$", "data", "=", "parent", "::", "getViewsData", "(", ")", ";", "$", "data", "[", "'event_enrollment_field_data'", "]", "[", "'table'", "]", "[", "'base'", "]", "=", "[", "'field'", "=>", "'id'", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Entity/EventEnrollmentViewsData.php#L16-L26
goalgorilla/open_social
modules/social_features/social_post/src/PostAccessControlHandler.php
PostAccessControlHandler.checkAccess
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_post\PostInterface $entity */ switch ($operation) { case 'view': // Public = ALL. if ($entity->isPublished()) { $visibility = $entity->field_visibility->value...
php
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_post\PostInterface $entity */ switch ($operation) { case 'view': // Public = ALL. if ($entity->isPublished()) { $visibility = $entity->field_visibility->value...
[ "protected", "function", "checkAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "/** @var \\Drupal\\social_post\\PostInterface $entity */", "switch", "(", "$", "operation", ")", "{", "case", "'vi...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostAccessControlHandler.php#L21-L120
goalgorilla/open_social
modules/social_features/social_post/src/PostAccessControlHandler.php
PostAccessControlHandler.checkDefaultAccess
protected function checkDefaultAccess(EntityInterface $entity, $operation, AccountInterface $account) { switch ($operation) { case 'view': if (!$entity->isPublished()) { if ($account->hasPermission('view own unpublished post entities', $account) && ($account->id() == $entity->getOwnerId())) ...
php
protected function checkDefaultAccess(EntityInterface $entity, $operation, AccountInterface $account) { switch ($operation) { case 'view': if (!$entity->isPublished()) { if ($account->hasPermission('view own unpublished post entities', $account) && ($account->id() == $entity->getOwnerId())) ...
[ "protected", "function", "checkDefaultAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "switch", "(", "$", "operation", ")", "{", "case", "'view'", ":", "if", "(", "!", "$", "entity", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostAccessControlHandler.php#L125-L145
goalgorilla/open_social
modules/social_features/social_post/src/PostAccessControlHandler.php
PostAccessControlHandler.checkCreateAccess
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { // If group context is active. $group = _social_group_get_current_group(); if ($group instanceof GroupInterface) { if ($group->hasPermission('add post entities in group', $account)) { if ($...
php
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { // If group context is active. $group = _social_group_get_current_group(); if ($group instanceof GroupInterface) { if ($group->hasPermission('add post entities in group', $account)) { if ($...
[ "protected", "function", "checkCreateAccess", "(", "AccountInterface", "$", "account", ",", "array", "$", "context", ",", "$", "entity_bundle", "=", "NULL", ")", "{", "// If group context is active.", "$", "group", "=", "_social_group_get_current_group", "(", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostAccessControlHandler.php#L150-L170
goalgorilla/open_social
modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsHelper.php
SocialProfileFieldsHelper.getProfileFields
public function getProfileFields($profile_type_id) { $fields = []; // Use storage to get only the profile fields of the current bundle type. try { $profile_fields = $this->entityTypeManager->getStorage('field_config')->loadByProperties(['entity_type' => 'profile', 'bundle' => $profile_type_id]); ...
php
public function getProfileFields($profile_type_id) { $fields = []; // Use storage to get only the profile fields of the current bundle type. try { $profile_fields = $this->entityTypeManager->getStorage('field_config')->loadByProperties(['entity_type' => 'profile', 'bundle' => $profile_type_id]); ...
[ "public", "function", "getProfileFields", "(", "$", "profile_type_id", ")", "{", "$", "fields", "=", "[", "]", ";", "// Use storage to get only the profile fields of the current bundle type.", "try", "{", "$", "profile_fields", "=", "$", "this", "->", "entityTypeManager...
Functions fetches profile fields from a profile type. @param string $profile_type_id The profile bundle. @return array An array of fields.
[ "Functions", "fetches", "profile", "fields", "from", "a", "profile", "type", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsHelper.php#L35-L61
goalgorilla/open_social
modules/social_features/social_group/src/Controller/DeleteGroup.php
DeleteGroup.deleteGroupAndContent
public static function deleteGroupAndContent($nids, $posts, &$context) { $results = []; // Load each node and delete it. foreach ($nids as $nid) { $node = Node::load($nid); $message = t('Delete @type "@title"', ['@type' => $node->getType(), '@title' => $node->getTitle()]); $results[] = $no...
php
public static function deleteGroupAndContent($nids, $posts, &$context) { $results = []; // Load each node and delete it. foreach ($nids as $nid) { $node = Node::load($nid); $message = t('Delete @type "@title"', ['@type' => $node->getType(), '@title' => $node->getTitle()]); $results[] = $no...
[ "public", "static", "function", "deleteGroupAndContent", "(", "$", "nids", ",", "$", "posts", ",", "&", "$", "context", ")", "{", "$", "results", "=", "[", "]", ";", "// Load each node and delete it.", "foreach", "(", "$", "nids", "as", "$", "nid", ")", ...
Get the group and all of its content that needs to be deleted.
[ "Get", "the", "group", "and", "all", "of", "its", "content", "that", "needs", "to", "be", "deleted", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/DeleteGroup.php#L20-L36
goalgorilla/open_social
modules/social_features/social_group/src/Controller/DeleteGroup.php
DeleteGroup.deleteGroupAndContentFinishedCallback
public static function deleteGroupAndContentFinishedCallback($success, $results, $operations) { // The 'success' parameter means no fatal PHP errors were detected. All // other error management should be handled using 'results'. if ($success) { $message = \Drupal::translation()->formatPlural( ...
php
public static function deleteGroupAndContentFinishedCallback($success, $results, $operations) { // The 'success' parameter means no fatal PHP errors were detected. All // other error management should be handled using 'results'. if ($success) { $message = \Drupal::translation()->formatPlural( ...
[ "public", "static", "function", "deleteGroupAndContentFinishedCallback", "(", "$", "success", ",", "$", "results", ",", "$", "operations", ")", "{", "// The 'success' parameter means no fatal PHP errors were detected. All", "// other error management should be handled using 'results'...
Callback when the batch for group and content deletion is done.
[ "Callback", "when", "the", "batch", "for", "group", "and", "content", "deletion", "is", "done", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/DeleteGroup.php#L41-L59
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/Fieldset.php
Fieldset.preprocessElement
protected function preprocessElement(Element $element, Variables $variables) { if (isset($element['#type']) && $element['#type'] == ('radios' || 'checkboxes')) { $variables['form_group'] = TRUE; } }
php
protected function preprocessElement(Element $element, Variables $variables) { if (isset($element['#type']) && $element['#type'] == ('radios' || 'checkboxes')) { $variables['form_group'] = TRUE; } }
[ "protected", "function", "preprocessElement", "(", "Element", "$", "element", ",", "Variables", "$", "variables", ")", "{", "if", "(", "isset", "(", "$", "element", "[", "'#type'", "]", ")", "&&", "$", "element", "[", "'#type'", "]", "==", "(", "'radios'...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Fieldset.php#L21-L26
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php
GroupAddBlock.blockAccess
public function blockAccess(AccountInterface $account) { $current_user = \Drupal::currentUser(); $route_user_id = \Drupal::routeMatch()->getParameter('user'); // Show this block only on current user Groups page. $can_create_groups = FALSE; foreach (GroupType::loadMultiple() as $group_type) { ...
php
public function blockAccess(AccountInterface $account) { $current_user = \Drupal::currentUser(); $route_user_id = \Drupal::routeMatch()->getParameter('user'); // Show this block only on current user Groups page. $can_create_groups = FALSE; foreach (GroupType::loadMultiple() as $group_type) { ...
[ "public", "function", "blockAccess", "(", "AccountInterface", "$", "account", ")", "{", "$", "current_user", "=", "\\", "Drupal", "::", "currentUser", "(", ")", ";", "$", "route_user_id", "=", "\\", "Drupal", "::", "routeMatch", "(", ")", "->", "getParameter...
{@inheritdoc} Custom access logic to display the block.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Block/GroupAddBlock.php#L27-L46
goalgorilla/open_social
modules/custom/activity_viewer/src/Plugin/views/filter/ActivityFilterPersonalisedHomepage.php
ActivityFilterPersonalisedHomepage.query
public function query() { $account = $this->view->getUser(); $group_memberships = social_group_get_all_group_members($account->id()); // Add tables and joins. $this->query->addTable('activity__field_activity_recipient_group'); $this->query->addTable('activity__field_activity_entity'); $configu...
php
public function query() { $account = $this->view->getUser(); $group_memberships = social_group_get_all_group_members($account->id()); // Add tables and joins. $this->query->addTable('activity__field_activity_recipient_group'); $this->query->addTable('activity__field_activity_entity'); $configu...
[ "public", "function", "query", "(", ")", "{", "$", "account", "=", "$", "this", "->", "view", "->", "getUser", "(", ")", ";", "$", "group_memberships", "=", "social_group_get_all_group_members", "(", "$", "account", "->", "id", "(", ")", ")", ";", "// Ad...
Filters out activity items the user is not allowed to see. The access to the activity items may be limited by the following: 1. Value in field_visibility_value on a Post entity. 2. Node access grants (this includes the field_node_visibility_value and the nodes in a closed group) 3. The comment or post is posted in a (...
[ "Filters", "out", "activity", "items", "the", "user", "is", "not", "allowed", "to", "see", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_viewer/src/Plugin/views/filter/ActivityFilterPersonalisedHomepage.php#L40-L184
goalgorilla/open_social
modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
EmailActivityDestination.getSendEmailOutputText
public static function getSendEmailOutputText(Message $message, $langcode = '') { $text = NULL; if (isset($message)) { $activity_factory = \Drupal::service('activity_creator.activity_factory'); $value = $activity_factory->getMessageText($message, $langcode); // Text for email. if (!empt...
php
public static function getSendEmailOutputText(Message $message, $langcode = '') { $text = NULL; if (isset($message)) { $activity_factory = \Drupal::service('activity_creator.activity_factory'); $value = $activity_factory->getMessageText($message, $langcode); // Text for email. if (!empt...
[ "public", "static", "function", "getSendEmailOutputText", "(", "Message", "$", "message", ",", "$", "langcode", "=", "''", ")", "{", "$", "text", "=", "NULL", ";", "if", "(", "isset", "(", "$", "message", ")", ")", "{", "$", "activity_factory", "=", "\...
Get field value for 'output_text' field from data array. @param \Drupal\message\Entity\Message $message The Message object. @param string $langcode The language in which we need to get the email text. @return string|null If we have message text we return the text, otherwise null.
[ "Get", "field", "value", "for", "output_text", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php#L52-L69
goalgorilla/open_social
modules/social_features/social_group/src/SocialGroupHelperService.php
SocialGroupHelperService.getGroupFromEntity
public function getGroupFromEntity(array $entity, $read_cache = TRUE) { $gid = NULL; // Comments can have groups based on what the comment is posted on so the // cache type differs from what we later use to fetch the group. $cache_type = $entity['target_type']; $cache_id = $entity['target_id']; ...
php
public function getGroupFromEntity(array $entity, $read_cache = TRUE) { $gid = NULL; // Comments can have groups based on what the comment is posted on so the // cache type differs from what we later use to fetch the group. $cache_type = $entity['target_type']; $cache_id = $entity['target_id']; ...
[ "public", "function", "getGroupFromEntity", "(", "array", "$", "entity", ",", "$", "read_cache", "=", "TRUE", ")", "{", "$", "gid", "=", "NULL", ";", "// Comments can have groups based on what the comment is posted on so the", "// cache type differs from what we later use to ...
Returns a group id from a entity (post, node). @param array $entity The entity in the form of an entity reference array to get the group for. @param bool $read_cache Whether the per request cache should be used. This should only be disabled if you know that the group for the entity has changed because disabling this c...
[ "Returns", "a", "group", "id", "from", "a", "entity", "(", "post", "node", ")", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SocialGroupHelperService.php#L57-L105
goalgorilla/open_social
modules/social_features/social_group/src/SocialGroupHelperService.php
SocialGroupHelperService.getDefaultGroupVisibility
public static function getDefaultGroupVisibility($type) { $visibility = &drupal_static(__FUNCTION__ . $type); if (empty($visibility)) { switch ($type) { case 'closed_group': $visibility = 'group'; break; case 'open_group': $visibility = 'community'; ...
php
public static function getDefaultGroupVisibility($type) { $visibility = &drupal_static(__FUNCTION__ . $type); if (empty($visibility)) { switch ($type) { case 'closed_group': $visibility = 'group'; break; case 'open_group': $visibility = 'community'; ...
[ "public", "static", "function", "getDefaultGroupVisibility", "(", "$", "type", ")", "{", "$", "visibility", "=", "&", "drupal_static", "(", "__FUNCTION__", ".", "$", "type", ")", ";", "if", "(", "empty", "(", "$", "visibility", ")", ")", "{", "switch", "...
Returns the default visibility. @param string $type The Group Type. @return string|null The default visibility.
[ "Returns", "the", "default", "visibility", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SocialGroupHelperService.php#L116-L142
goalgorilla/open_social
modules/social_features/social_group/src/SocialGroupHelperService.php
SocialGroupHelperService.getAllGroupsForUser
public function getAllGroupsForUser($uid) { $groups = &drupal_static(__FUNCTION__); // Get the memberships for the user if they aren't known yet. if (!isset($groups[$uid])) { $group_content_types = GroupContentType::loadByEntityTypeId('user'); $group_content_types = array_keys($group_content_ty...
php
public function getAllGroupsForUser($uid) { $groups = &drupal_static(__FUNCTION__); // Get the memberships for the user if they aren't known yet. if (!isset($groups[$uid])) { $group_content_types = GroupContentType::loadByEntityTypeId('user'); $group_content_types = array_keys($group_content_ty...
[ "public", "function", "getAllGroupsForUser", "(", "$", "uid", ")", "{", "$", "groups", "=", "&", "drupal_static", "(", "__FUNCTION__", ")", ";", "// Get the memberships for the user if they aren't known yet.", "if", "(", "!", "isset", "(", "$", "groups", "[", "$",...
Get all group memberships for a certain user. @param int $uid The UID for which we fetch the groups he is member of. @return array List of group IDs the user is member of.
[ "Get", "all", "group", "memberships", "for", "a", "certain", "user", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SocialGroupHelperService.php#L153-L172
goalgorilla/open_social
modules/social_features/social_group/modules/social_group_default_route/src/EventSubscriber/RedirectSubscriber.php
RedirectSubscriber.groupLandingPage
public function groupLandingPage(GetResponseEvent $event) { // First check if the current route is the group canonical. $routeMatch = $this->currentRoute->getRouteName(); // Not group canonical, then we leave. if ($routeMatch !== 'entity.group.canonical') { return; } // Fetch the group ...
php
public function groupLandingPage(GetResponseEvent $event) { // First check if the current route is the group canonical. $routeMatch = $this->currentRoute->getRouteName(); // Not group canonical, then we leave. if ($routeMatch !== 'entity.group.canonical') { return; } // Fetch the group ...
[ "public", "function", "groupLandingPage", "(", "GetResponseEvent", "$", "event", ")", "{", "// First check if the current route is the group canonical.", "$", "routeMatch", "=", "$", "this", "->", "currentRoute", "->", "getRouteName", "(", ")", ";", "// Not group canonica...
This method is called when the KernelEvents::REQUEST event is dispatched. @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event The event.
[ "This", "method", "is", "called", "when", "the", "KernelEvents", "::", "REQUEST", "event", "is", "dispatched", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_default_route/src/EventSubscriber/RedirectSubscriber.php#L66-L114
goalgorilla/open_social
modules/social_features/social_group/modules/social_group_gvbo/src/Access/SocialGroupViewsBulkOperationsAccess.php
SocialGroupViewsBulkOperationsAccess.access
public function access(AccountInterface $account, RouteMatch $routeMatch) { $parameters = [ 'view_id' => 'group_manage_members', 'display_id' => 'page_group_manage_members', ]; $route = $routeMatch->getRouteObject(); foreach ($parameters as $key => $value) { $route->setDefault($key, ...
php
public function access(AccountInterface $account, RouteMatch $routeMatch) { $parameters = [ 'view_id' => 'group_manage_members', 'display_id' => 'page_group_manage_members', ]; $route = $routeMatch->getRouteObject(); foreach ($parameters as $key => $value) { $route->setDefault($key, ...
[ "public", "function", "access", "(", "AccountInterface", "$", "account", ",", "RouteMatch", "$", "routeMatch", ")", "{", "$", "parameters", "=", "[", "'view_id'", "=>", "'group_manage_members'", ",", "'display_id'", "=>", "'page_group_manage_members'", ",", "]", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_gvbo/src/Access/SocialGroupViewsBulkOperationsAccess.php#L17-L34
goalgorilla/open_social
modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php
SocialPostPostForm.buildOptionsForm
public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $options = []; /** @var \Drupal\block_field\BlockFieldManagerInterface $block_field_manager */ $definitions = $this->getBlockDefinitions(); foreach ($definitions as $id => $defin...
php
public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $options = []; /** @var \Drupal\block_field\BlockFieldManagerInterface $block_field_manager */ $definitions = $this->getBlockDefinitions(); foreach ($definitions as $id => $defin...
[ "public", "function", "buildOptionsForm", "(", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "parent", "::", "buildOptionsForm", "(", "$", "form", ",", "$", "form_state", ")", ";", "$", "options", "=", "[", "]", ";", "/** @var \...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php#L57-L77
goalgorilla/open_social
modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php
SocialPostPostForm.getBlockDefinitions
protected function getBlockDefinitions() { $definitions = $this->blockManager->getSortedDefinitions(); $block_definitions = []; foreach ($definitions as $plugin_id => $definition) { // Context aware plugins are not currently supported. // Core and component plugins can be context-aware // ...
php
protected function getBlockDefinitions() { $definitions = $this->blockManager->getSortedDefinitions(); $block_definitions = []; foreach ($definitions as $plugin_id => $definition) { // Context aware plugins are not currently supported. // Core and component plugins can be context-aware // ...
[ "protected", "function", "getBlockDefinitions", "(", ")", "{", "$", "definitions", "=", "$", "this", "->", "blockManager", "->", "getSortedDefinitions", "(", ")", ";", "$", "block_definitions", "=", "[", "]", ";", "foreach", "(", "$", "definitions", "as", "$...
Get sorted listed of supported block definitions. @return array An associative array of supported block definitions.
[ "Get", "sorted", "listed", "of", "supported", "block", "definitions", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php#L85-L100
goalgorilla/open_social
modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php
SocialPostPostForm.render
public function render($empty = FALSE) { /** @var \Drupal\block_field\BlockFieldItemInterface $item */ $block_instance = $this->getBlock(); // Make sure the block exists and is accessible. if (!$block_instance || !$block_instance->access(\Drupal::currentUser())) { return NULL; } // @see ...
php
public function render($empty = FALSE) { /** @var \Drupal\block_field\BlockFieldItemInterface $item */ $block_instance = $this->getBlock(); // Make sure the block exists and is accessible. if (!$block_instance || !$block_instance->access(\Drupal::currentUser())) { return NULL; } // @see ...
[ "public", "function", "render", "(", "$", "empty", "=", "FALSE", ")", "{", "/** @var \\Drupal\\block_field\\BlockFieldItemInterface $item */", "$", "block_instance", "=", "$", "this", "->", "getBlock", "(", ")", ";", "// Make sure the block exists and is accessible.", "if...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php#L105-L130
goalgorilla/open_social
modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php
SocialPostPostForm.getBlock
protected function getBlock() { if (empty($this->options['block_id'])) { return NULL; } /** @var \Drupal\Core\Block\BlockManagerInterface $block_manager */ $block_manager = \Drupal::service('plugin.manager.block'); /** @var \Drupal\Core\Block\BlockPluginInterface $block_instance */ $bloc...
php
protected function getBlock() { if (empty($this->options['block_id'])) { return NULL; } /** @var \Drupal\Core\Block\BlockManagerInterface $block_manager */ $block_manager = \Drupal::service('plugin.manager.block'); /** @var \Drupal\Core\Block\BlockPluginInterface $block_instance */ $bloc...
[ "protected", "function", "getBlock", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "options", "[", "'block_id'", "]", ")", ")", "{", "return", "NULL", ";", "}", "/** @var \\Drupal\\Core\\Block\\BlockManagerInterface $block_manager */", "$", "block_man...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php#L135-L162
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/Plugin/Network/LinkedInAuth.php
LinkedInAuth.initSdk
public function initSdk() { $class_name = '\Happyr\LinkedIn\LinkedIn'; if (!class_exists($class_name)) { throw new SocialApiException(sprintf('The PHP SDK for LinkedIn could not be found. Class: %s.', $class_name)); } if (!$this->validateConfig($this->settings)) { return FALSE; } ...
php
public function initSdk() { $class_name = '\Happyr\LinkedIn\LinkedIn'; if (!class_exists($class_name)) { throw new SocialApiException(sprintf('The PHP SDK for LinkedIn could not be found. Class: %s.', $class_name)); } if (!$this->validateConfig($this->settings)) { return FALSE; } ...
[ "public", "function", "initSdk", "(", ")", "{", "$", "class_name", "=", "'\\Happyr\\LinkedIn\\LinkedIn'", ";", "if", "(", "!", "class_exists", "(", "$", "class_name", ")", ")", "{", "throw", "new", "SocialApiException", "(", "sprintf", "(", "'The PHP SDK for Lin...
Returns an instance of sdk. @return mixed Returns a new LinkedIn instance or FALSE if the config was incorrect. @throws \Drupal\social_api\SocialApiException
[ "Returns", "an", "instance", "of", "sdk", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/Plugin/Network/LinkedInAuth.php#L65-L77
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/Plugin/Network/LinkedInAuth.php
LinkedInAuth.validateConfig
protected function validateConfig(LinkedInAuthSettings $settings) { $client_id = $settings->getClientId(); $client_secret = $settings->getClientSecret(); if (!$client_id || !$client_secret) { $this->loggerFactory ->get('social_auth_linkedin') ->error('Define Client ID and Client Secre...
php
protected function validateConfig(LinkedInAuthSettings $settings) { $client_id = $settings->getClientId(); $client_secret = $settings->getClientSecret(); if (!$client_id || !$client_secret) { $this->loggerFactory ->get('social_auth_linkedin') ->error('Define Client ID and Client Secre...
[ "protected", "function", "validateConfig", "(", "LinkedInAuthSettings", "$", "settings", ")", "{", "$", "client_id", "=", "$", "settings", "->", "getClientId", "(", ")", ";", "$", "client_secret", "=", "$", "settings", "->", "getClientSecret", "(", ")", ";", ...
Checks that module is configured. @param \Drupal\social_auth_linkedin\Settings\LinkedInAuthSettings $settings The LinkedIn auth settings. @return bool True if module is configured, False otherwise.
[ "Checks", "that", "module", "is", "configured", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/Plugin/Network/LinkedInAuth.php#L98-L111
goalgorilla/open_social
modules/social_features/social_user/src/ContextProvider/UserRouteContext.php
UserRouteContext.getRuntimeContexts
public function getRuntimeContexts(array $unqualified_context_ids) { // Create an optional context definition for user entities. $context_definition = new ContextDefinition('entity:user', $this->t('User from URL'), FALSE); // Cache this context on the route. $cacheability = new CacheableMetadata(); ...
php
public function getRuntimeContexts(array $unqualified_context_ids) { // Create an optional context definition for user entities. $context_definition = new ContextDefinition('entity:user', $this->t('User from URL'), FALSE); // Cache this context on the route. $cacheability = new CacheableMetadata(); ...
[ "public", "function", "getRuntimeContexts", "(", "array", "$", "unqualified_context_ids", ")", "{", "// Create an optional context definition for user entities.", "$", "context_definition", "=", "new", "ContextDefinition", "(", "'entity:user'", ",", "$", "this", "->", "t", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/ContextProvider/UserRouteContext.php#L53-L68
goalgorilla/open_social
modules/social_features/social_user/src/ContextProvider/UserRouteContext.php
UserRouteContext.getUserFromRoute
public function getUserFromRoute() { $route_match = $this->currentRouteMatch; // See if the route has a user parameter and try to retrieve it. if (($account = $route_match->getParameter('user'))) { if ($account instanceof UserInterface) { return $account; } elseif (is_numeric($acc...
php
public function getUserFromRoute() { $route_match = $this->currentRouteMatch; // See if the route has a user parameter and try to retrieve it. if (($account = $route_match->getParameter('user'))) { if ($account instanceof UserInterface) { return $account; } elseif (is_numeric($acc...
[ "public", "function", "getUserFromRoute", "(", ")", "{", "$", "route_match", "=", "$", "this", "->", "currentRouteMatch", ";", "// See if the route has a user parameter and try to retrieve it.", "if", "(", "(", "$", "account", "=", "$", "route_match", "->", "getParame...
Retrieves the user entity from the current route. This will try to load the user entity from the route if present. @return \Drupal\user\UserInterface|null A user entity if one could be found, NULL otherwise.
[ "Retrieves", "the", "user", "entity", "from", "the", "current", "route", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/ContextProvider/UserRouteContext.php#L78-L94
goalgorilla/open_social
modules/social_features/social_user/src/Plugin/Block/AccountHeaderBlock.php
AccountHeaderBlock.build
public function build() { // This context is used to pass the block context to hooks. $context = $this->getContextValues(); $block = [ '#attributes' => [ 'class' => ['navbar-user'], ], 'menu_items' => [ '#theme' => 'item_list', '#list_type' => 'ul', '#attri...
php
public function build() { // This context is used to pass the block context to hooks. $context = $this->getContextValues(); $block = [ '#attributes' => [ 'class' => ['navbar-user'], ], 'menu_items' => [ '#theme' => 'item_list', '#list_type' => 'ul', '#attri...
[ "public", "function", "build", "(", ")", "{", "// This context is used to pass the block context to hooks.", "$", "context", "=", "$", "this", "->", "getContextValues", "(", ")", ";", "$", "block", "=", "[", "'#attributes'", "=>", "[", "'class'", "=>", "[", "'na...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Plugin/Block/AccountHeaderBlock.php#L112-L266
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/InputButton.php
InputButton.preprocessElement
public function preprocessElement(Element $element, Variables $variables) { $element->setButtonSize(); $element->setIcon($element->getProperty('icon')); $variables['icon_only'] = $element->getProperty('icon_only'); $variables['icon_position'] = $element->getProperty('icon_position'); $variables['lab...
php
public function preprocessElement(Element $element, Variables $variables) { $element->setButtonSize(); $element->setIcon($element->getProperty('icon')); $variables['icon_only'] = $element->getProperty('icon_only'); $variables['icon_position'] = $element->getProperty('icon_position'); $variables['lab...
[ "public", "function", "preprocessElement", "(", "Element", "$", "element", ",", "Variables", "$", "variables", ")", "{", "$", "element", "->", "setButtonSize", "(", ")", ";", "$", "element", "->", "setIcon", "(", "$", "element", "->", "getProperty", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/InputButton.php#L21-L32
goalgorilla/open_social
modules/social_features/social_content_report/src/Controller/ReportController.php
ReportController.close
public function close(FlaggingInterface $flagging) { if ($flagging->hasField('field_status')) { // Disable the status field. $flagging->set('field_status', 0); $flagging->save(); } return new RedirectResponse('view.report_overview.overview'); }
php
public function close(FlaggingInterface $flagging) { if ($flagging->hasField('field_status')) { // Disable the status field. $flagging->set('field_status', 0); $flagging->save(); } return new RedirectResponse('view.report_overview.overview'); }
[ "public", "function", "close", "(", "FlaggingInterface", "$", "flagging", ")", "{", "if", "(", "$", "flagging", "->", "hasField", "(", "'field_status'", ")", ")", "{", "// Disable the status field.", "$", "flagging", "->", "set", "(", "'field_status'", ",", "0...
Function for suggestions. @param \Drupal\flag\FlaggingInterface $flagging The Flagging object to close. @return \Symfony\Component\HttpFoundation\RedirectResponse A simple response. @throws \Drupal\Core\Entity\EntityStorageException
[ "Function", "for", "suggestions", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Controller/ReportController.php#L27-L36
goalgorilla/open_social
modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php
FileAndImageTableFormatter.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { // Grab elements from the ImageFormatter and see if we can attach files? $elements = parent::viewElements($items, $langcode); foreach ($this->getEntitiesToView($items, $langcode) as $delta => $file) { $item = $file->_referringIt...
php
public function viewElements(FieldItemListInterface $items, $langcode) { // Grab elements from the ImageFormatter and see if we can attach files? $elements = parent::viewElements($items, $langcode); foreach ($this->getEntitiesToView($items, $langcode) as $delta => $file) { $item = $file->_referringIt...
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "// Grab elements from the ImageFormatter and see if we can attach files?", "$", "elements", "=", "parent", "::", "viewElements", "(", "$", "items", ",", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php#L25-L61
goalgorilla/open_social
modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php
FileAndImageTableFormatter.isImage
private function isImage(FileInterface $file) { $image = $this->getImage($file); if ($image === NULL) { return FALSE; } return $image->isValid(); }
php
private function isImage(FileInterface $file) { $image = $this->getImage($file); if ($image === NULL) { return FALSE; } return $image->isValid(); }
[ "private", "function", "isImage", "(", "FileInterface", "$", "file", ")", "{", "$", "image", "=", "$", "this", "->", "getImage", "(", "$", "file", ")", ";", "if", "(", "$", "image", "===", "NULL", ")", "{", "return", "FALSE", ";", "}", "return", "$...
Check if its a file or image so we know what to render. @param \Drupal\file\FileInterface $file A file entity. This function may resize the file affecting its size. @return bool TRUE when it's an image and not a file
[ "Check", "if", "its", "a", "file", "or", "image", "so", "we", "know", "what", "to", "render", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php#L72-L80
goalgorilla/open_social
modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php
FileAndImageTableFormatter.getImage
private function getImage(FileInterface $file) { // Make sure we deal with a file. $image_factory = \Drupal::service('image.factory'); return $image_factory->get($file->getFileUri()); }
php
private function getImage(FileInterface $file) { // Make sure we deal with a file. $image_factory = \Drupal::service('image.factory'); return $image_factory->get($file->getFileUri()); }
[ "private", "function", "getImage", "(", "FileInterface", "$", "file", ")", "{", "// Make sure we deal with a file.", "$", "image_factory", "=", "\\", "Drupal", "::", "service", "(", "'image.factory'", ")", ";", "return", "$", "image_factory", "->", "get", "(", "...
Grab the Image if we are dealing with one. @param \Drupal\file\FileInterface $file A file entity. This function may resize the file affecting its size. @return \Drupal\Core\Image\ImageInterface An Image object.
[ "Grab", "the", "Image", "if", "we", "are", "dealing", "with", "one", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment_upload/src/Plugin/Field/FieldFormatter/FileAndImageTableFormatter.php#L91-L96
goalgorilla/open_social
modules/social_features/social_search/src/SocialSearchBreadcrumbBuilder.php
SocialSearchBreadcrumbBuilder.build
public function build(RouteMatchInterface $route_match) { $breadcrumb = new Breadcrumb(); switch ($route_match->getRouteName()) { case 'view.search_content.page': case 'view.search_content.page_no_value': case 'view.search_users.page': case 'view.search_users.page_no_value': case ...
php
public function build(RouteMatchInterface $route_match) { $breadcrumb = new Breadcrumb(); switch ($route_match->getRouteName()) { case 'view.search_content.page': case 'view.search_content.page_no_value': case 'view.search_users.page': case 'view.search_users.page_no_value': case ...
[ "public", "function", "build", "(", "RouteMatchInterface", "$", "route_match", ")", "{", "$", "breadcrumb", "=", "new", "Breadcrumb", "(", ")", ";", "switch", "(", "$", "route_match", "->", "getRouteName", "(", ")", ")", "{", "case", "'view.search_content.page...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/SocialSearchBreadcrumbBuilder.php#L37-L64
goalgorilla/open_social
modules/custom/activity_viewer/src/Plugin/views/argument/ActivityGroupArgument.php
ActivityGroupArgument.query
public function query($group_by = FALSE) { $this->ensureMyTable(); // \Drupal\views\Plugin\views\query\QueryPluginBase. $this->query->addTable('activity__field_activity_recipient_group'); $this->query->addTable('activity__field_activity_entity'); $this->query->addTable('activity__field_activity_des...
php
public function query($group_by = FALSE) { $this->ensureMyTable(); // \Drupal\views\Plugin\views\query\QueryPluginBase. $this->query->addTable('activity__field_activity_recipient_group'); $this->query->addTable('activity__field_activity_entity'); $this->query->addTable('activity__field_activity_des...
[ "public", "function", "query", "(", "$", "group_by", "=", "FALSE", ")", "{", "$", "this", "->", "ensureMyTable", "(", ")", ";", "// \\Drupal\\views\\Plugin\\views\\query\\QueryPluginBase.", "$", "this", "->", "query", "->", "addTable", "(", "'activity__field_activit...
Set up the query for this argument. The argument sent may be found at $this->argument.
[ "Set", "up", "the", "query", "for", "this", "argument", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_viewer/src/Plugin/views/argument/ActivityGroupArgument.php#L21-L36
goalgorilla/open_social
modules/custom/activity_creator/src/Plugin/ActivityContextBase.php
ActivityContextBase.getRecipientsFromPost
public function getRecipientsFromPost(array $referenced_entity) { $recipients = []; $post = Post::load($referenced_entity['target_id']); $recipient_user = $post->get('field_recipient_user')->getValue(); if (!empty($recipient_user)) { $recipients[] = [ 'target_type' => 'user', 'tar...
php
public function getRecipientsFromPost(array $referenced_entity) { $recipients = []; $post = Post::load($referenced_entity['target_id']); $recipient_user = $post->get('field_recipient_user')->getValue(); if (!empty($recipient_user)) { $recipients[] = [ 'target_type' => 'user', 'tar...
[ "public", "function", "getRecipientsFromPost", "(", "array", "$", "referenced_entity", ")", "{", "$", "recipients", "=", "[", "]", ";", "$", "post", "=", "Post", "::", "load", "(", "$", "referenced_entity", "[", "'target_id'", "]", ")", ";", "$", "recipien...
Returns recipients from post.
[ "Returns", "recipients", "from", "post", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Plugin/ActivityContextBase.php#L73-L86
goalgorilla/open_social
modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php
PeopleAccess.access
public function access(AccountInterface $account) { // Check if user has administer users or view user access. $administerUsers = $account->hasPermission('administer users'); $viewUsers = $account->hasPermission('view users'); return $administerUsers | $viewUsers; }
php
public function access(AccountInterface $account) { // Check if user has administer users or view user access. $administerUsers = $account->hasPermission('administer users'); $viewUsers = $account->hasPermission('view users'); return $administerUsers | $viewUsers; }
[ "public", "function", "access", "(", "AccountInterface", "$", "account", ")", "{", "// Check if user has administer users or view user access.", "$", "administerUsers", "=", "$", "account", "->", "hasPermission", "(", "'administer users'", ")", ";", "$", "viewUsers", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Plugin/views/access/PeopleAccess.php#L32-L37
goalgorilla/open_social
modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php
SuperUser.supportsIndex
public static function supportsIndex(IndexInterface $index) { $supported_entity_types = ['profile']; foreach ($index->getDatasources() as $datasource) { if (in_array($datasource->getEntityTypeId(), $supported_entity_types)) { return TRUE; } } return FALSE; }
php
public static function supportsIndex(IndexInterface $index) { $supported_entity_types = ['profile']; foreach ($index->getDatasources() as $datasource) { if (in_array($datasource->getEntityTypeId(), $supported_entity_types)) { return TRUE; } } return FALSE; }
[ "public", "static", "function", "supportsIndex", "(", "IndexInterface", "$", "index", ")", "{", "$", "supported_entity_types", "=", "[", "'profile'", "]", ";", "foreach", "(", "$", "index", "->", "getDatasources", "(", ")", "as", "$", "datasource", ")", "{",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php#L27-L35
goalgorilla/open_social
modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php
SuperUser.alterIndexedItems
public function alterIndexedItems(array &$items) { foreach ($items as $item_id => $item) { $object = $item->getOriginalObject()->getValue(); if ($object instanceof ProfileInterface) { // Profile ownedId is the userId. if ($object->getOwnerId() == '1') { unset($items[$item_id]);...
php
public function alterIndexedItems(array &$items) { foreach ($items as $item_id => $item) { $object = $item->getOriginalObject()->getValue(); if ($object instanceof ProfileInterface) { // Profile ownedId is the userId. if ($object->getOwnerId() == '1') { unset($items[$item_id]);...
[ "public", "function", "alterIndexedItems", "(", "array", "&", "$", "items", ")", "{", "foreach", "(", "$", "items", "as", "$", "item_id", "=>", "$", "item", ")", "{", "$", "object", "=", "$", "item", "->", "getOriginalObject", "(", ")", "->", "getValue...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Plugin/search_api/processor/SuperUser.php#L40-L55
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityAccessControlHandler.php
ActivityAccessControlHandler.checkAccess
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\activity_creator\ActivityInterface $entity */ switch ($operation) { case 'view': $recipient = $entity->getRecipient(); if ($recipient === NULL) { // This is simple, t...
php
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\activity_creator\ActivityInterface $entity */ switch ($operation) { case 'view': $recipient = $entity->getRecipient(); if ($recipient === NULL) { // This is simple, t...
[ "protected", "function", "checkAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "/** @var \\Drupal\\activity_creator\\ActivityInterface $entity */", "switch", "(", "$", "operation", ")", "{", "case...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityAccessControlHandler.php#L20-L58
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityAccessControlHandler.php
ActivityAccessControlHandler.returnAccessRelatedObject
protected function returnAccessRelatedObject(EntityInterface $entity, $operation, $account) { $related_object = $entity->get('field_activity_entity')->getValue(); if (!empty($related_object)) { $ref_entity_type = $related_object['0']['target_type']; $ref_entity_id = $related_object['0']['target_id']...
php
protected function returnAccessRelatedObject(EntityInterface $entity, $operation, $account) { $related_object = $entity->get('field_activity_entity')->getValue(); if (!empty($related_object)) { $ref_entity_type = $related_object['0']['target_type']; $ref_entity_id = $related_object['0']['target_id']...
[ "protected", "function", "returnAccessRelatedObject", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "$", "account", ")", "{", "$", "related_object", "=", "$", "entity", "->", "get", "(", "'field_activity_entity'", ")", "->", "getValue", "(",...
Return access control from the related entity.
[ "Return", "access", "control", "from", "the", "related", "entity", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityAccessControlHandler.php#L70-L79
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityAccessControlHandler.php
ActivityAccessControlHandler.checkIfPersonalNotification
protected function checkIfPersonalNotification(EntityInterface $entity) { $recipient = $entity->getRecipient(); $value = FALSE; if (!empty($recipient) && $recipient['0']['target_type'] === 'user') { // This could be personalised, but first lets check the destinations. $destinations = $entity->ge...
php
protected function checkIfPersonalNotification(EntityInterface $entity) { $recipient = $entity->getRecipient(); $value = FALSE; if (!empty($recipient) && $recipient['0']['target_type'] === 'user') { // This could be personalised, but first lets check the destinations. $destinations = $entity->ge...
[ "protected", "function", "checkIfPersonalNotification", "(", "EntityInterface", "$", "entity", ")", "{", "$", "recipient", "=", "$", "entity", "->", "getRecipient", "(", ")", ";", "$", "value", "=", "FALSE", ";", "if", "(", "!", "empty", "(", "$", "recipie...
Check if this is a personal notification. @param \Drupal\Core\Entity\EntityInterface $entity Entity object. @return bool Returns TRUE if entity is personal notification, FALSE if it isn't.
[ "Check", "if", "this", "is", "a", "personal", "notification", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityAccessControlHandler.php#L90-L103
goalgorilla/open_social
modules/social_features/social_private_message/src/Mapper/PrivateMessageMapper.php
PrivateMessageMapper.getUserIdsFromString
public function getUserIdsFromString($string, $count) { if ($this->currentUser->hasPermission('access user profiles') && $this->currentUser->hasPermission('use private messaging system')) { return $this->getUserIdsFromName($string, $count); } return []; }
php
public function getUserIdsFromString($string, $count) { if ($this->currentUser->hasPermission('access user profiles') && $this->currentUser->hasPermission('use private messaging system')) { return $this->getUserIdsFromName($string, $count); } return []; }
[ "public", "function", "getUserIdsFromString", "(", "$", "string", ",", "$", "count", ")", "{", "if", "(", "$", "this", "->", "currentUser", "->", "hasPermission", "(", "'access user profiles'", ")", "&&", "$", "this", "->", "currentUser", "->", "hasPermission"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Mapper/PrivateMessageMapper.php#L20-L26
goalgorilla/open_social
themes/socialbase/src/Plugin/Alter/ThemeSuggestions.php
ThemeSuggestions.alter
public function alter(&$suggestions, &$context1 = NULL, &$hook = NULL) { parent::alter($suggestions, $context1, $hook); $variables = $this->variables; switch ($hook) { case 'block': if (isset($variables['elements']['#base_plugin_id']) && $variables['elements']['#base_plugin_id'] == 'system...
php
public function alter(&$suggestions, &$context1 = NULL, &$hook = NULL) { parent::alter($suggestions, $context1, $hook); $variables = $this->variables; switch ($hook) { case 'block': if (isset($variables['elements']['#base_plugin_id']) && $variables['elements']['#base_plugin_id'] == 'system...
[ "public", "function", "alter", "(", "&", "$", "suggestions", ",", "&", "$", "context1", "=", "NULL", ",", "&", "$", "hook", "=", "NULL", ")", "{", "parent", "::", "alter", "(", "$", "suggestions", ",", "$", "context1", ",", "$", "hook", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Alter/ThemeSuggestions.php#L20-L309
goalgorilla/open_social
modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php
SocialLanguageMetadataBubblingUrlGenerator.generateFromRoute
public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) { if (isset($options['language']) && $options['language'] instanceof LanguageInterface) { $language = $this->languageManager->getCurrentLanguage(); if ($options['language']->getId() != $langu...
php
public function generateFromRoute($name, $parameters = [], $options = [], $collect_bubbleable_metadata = FALSE) { if (isset($options['language']) && $options['language'] instanceof LanguageInterface) { $language = $this->languageManager->getCurrentLanguage(); if ($options['language']->getId() != $langu...
[ "public", "function", "generateFromRoute", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "options", "=", "[", "]", ",", "$", "collect_bubbleable_metadata", "=", "FALSE", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'lan...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_language/src/SocialLanguageMetadataBubblingUrlGenerator.php#L44-L70
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/Select.php
Select.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); if (isset($variables['element']['#multiple']) && $variables['element']['#multiple'] == TRUE) { $variables['multiselect'] = TRUE; } }
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); if (isset($variables['element']['#multiple']) && $variables['element']['#multiple'] == TRUE) { $variables['multiselect'] = TRUE; } }
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "if", "(", "isset", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Select.php#L19-L26
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/Action/ExportUser.php
ExportUser.executeMultiple
public function executeMultiple(array $entities) { // Check if headers exists. if (empty($this->context['sandbox']['results']['headers'])) { $headers = []; /** @var \Drupal\social_user_export\Plugin\UserExportPluginBase $instance */ foreach ($this->pluginDefinitions as $plugin_id => $plugin_d...
php
public function executeMultiple(array $entities) { // Check if headers exists. if (empty($this->context['sandbox']['results']['headers'])) { $headers = []; /** @var \Drupal\social_user_export\Plugin\UserExportPluginBase $instance */ foreach ($this->pluginDefinitions as $plugin_id => $plugin_d...
[ "public", "function", "executeMultiple", "(", "array", "$", "entities", ")", "{", "// Check if headers exists.", "if", "(", "empty", "(", "$", "this", "->", "context", "[", "'sandbox'", "]", "[", "'results'", "]", "[", "'headers'", "]", ")", ")", "{", "$",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/Action/ExportUser.php#L88-L148
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFSFile.php
MongoGridFSFile.write
public function write($filename = null) { if ($filename === null) { $filename = $this->getFilename(); } if (empty($filename)) { $filename = 'file'; } if (! $handle = fopen($filename, 'w')) { trigger_error('Can not open the destination file...
php
public function write($filename = null) { if ($filename === null) { $filename = $this->getFilename(); } if (empty($filename)) { $filename = 'file'; } if (! $handle = fopen($filename, 'w')) { trigger_error('Can not open the destination file...
[ "public", "function", "write", "(", "$", "filename", "=", "null", ")", "{", "if", "(", "$", "filename", "===", "null", ")", "{", "$", "filename", "=", "$", "this", "->", "getFilename", "(", ")", ";", "}", "if", "(", "empty", "(", "$", "filename", ...
Writes this file to the filesystem @link http://php.net/manual/en/mongogridfsfile.write.php @param string $filename The location to which to write the file (path+filename+extension). If none is given, the stored filename will be used. @return int Returns the number of bytes written
[ "Writes", "this", "file", "to", "the", "filesystem" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFSFile.php#L72-L90
alcaeus/mongo-php-adapter
lib/Mongo/MongoGridFSFile.php
MongoGridFSFile.getBytes
public function getBytes() { $result = ''; foreach ($this->getChunks() as $chunk) { $result .= $chunk['data']->bin; } return $result; }
php
public function getBytes() { $result = ''; foreach ($this->getChunks() as $chunk) { $result .= $chunk['data']->bin; } return $result; }
[ "public", "function", "getBytes", "(", ")", "{", "$", "result", "=", "''", ";", "foreach", "(", "$", "this", "->", "getChunks", "(", ")", "as", "$", "chunk", ")", "{", "$", "result", ".=", "$", "chunk", "[", "'data'", "]", "->", "bin", ";", "}", ...
This will load the file into memory. If the file is bigger than your memory, this will cause problems! @link http://php.net/manual/en/mongogridfsfile.getbytes.php @return string Returns a string of the bytes in the file
[ "This", "will", "load", "the", "file", "into", "memory", ".", "If", "the", "file", "is", "bigger", "than", "your", "memory", "this", "will", "cause", "problems!" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoGridFSFile.php#L97-L105
alcaeus/mongo-php-adapter
lib/Mongo/MongoCursor.php
MongoCursor.addOption
public function addOption($key, $value) { $this->errorIfOpened(); $this->options[$key] = $value; return $this; }
php
public function addOption($key, $value) { $this->errorIfOpened(); $this->options[$key] = $value; return $this; }
[ "public", "function", "addOption", "(", "$", "key", ",", "$", "value", ")", "{", "$", "this", "->", "errorIfOpened", "(", ")", ";", "$", "this", "->", "options", "[", "$", "key", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Adds a top-level key/value pair to a query @link http://www.php.net/manual/en/mongocursor.addoption.php @param string $key Fieldname to add. @param mixed $value Value to add. @throws MongoCursorException @return MongoCursor Returns this cursor
[ "Adds", "a", "top", "-", "level", "key", "/", "value", "pair", "to", "a", "query" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCursor.php#L107-L113
alcaeus/mongo-php-adapter
lib/Mongo/MongoCursor.php
MongoCursor.count
public function count($foundOnly = false) { $optionNames = ['hint', 'maxTimeMS']; if ($foundOnly) { $optionNames = array_merge($optionNames, ['limit', 'skip']); } $options = $this->getOptions($optionNames) + $this->options; try { $count = $this->colle...
php
public function count($foundOnly = false) { $optionNames = ['hint', 'maxTimeMS']; if ($foundOnly) { $optionNames = array_merge($optionNames, ['limit', 'skip']); } $options = $this->getOptions($optionNames) + $this->options; try { $count = $this->colle...
[ "public", "function", "count", "(", "$", "foundOnly", "=", "false", ")", "{", "$", "optionNames", "=", "[", "'hint'", ",", "'maxTimeMS'", "]", ";", "if", "(", "$", "foundOnly", ")", "{", "$", "optionNames", "=", "array_merge", "(", "$", "optionNames", ...
Counts the number of results for this query @link http://www.php.net/manual/en/mongocursor.count.php @param bool $foundOnly Send cursor limit and skip information to the count function, if applicable. @return int The number of documents returned by this cursor's query.
[ "Counts", "the", "number", "of", "results", "for", "this", "query" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCursor.php#L136-L153
alcaeus/mongo-php-adapter
lib/Mongo/MongoCursor.php
MongoCursor.doQuery
protected function doQuery() { $options = $this->getOptions() + $this->options; try { $this->cursor = $this->collection->find(TypeConverter::fromLegacy($this->query), $options); } catch (\MongoDB\Driver\Exception\ExecutionTimeoutException $e) { throw new MongoCursorT...
php
protected function doQuery() { $options = $this->getOptions() + $this->options; try { $this->cursor = $this->collection->find(TypeConverter::fromLegacy($this->query), $options); } catch (\MongoDB\Driver\Exception\ExecutionTimeoutException $e) { throw new MongoCursorT...
[ "protected", "function", "doQuery", "(", ")", "{", "$", "options", "=", "$", "this", "->", "getOptions", "(", ")", "+", "$", "this", "->", "options", ";", "try", "{", "$", "this", "->", "cursor", "=", "$", "this", "->", "collection", "->", "find", ...
Execute the query @link http://www.php.net/manual/en/mongocursor.doquery.php @throws MongoConnectionException if it cannot reach the database. @return void
[ "Execute", "the", "query" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCursor.php#L161-L172
alcaeus/mongo-php-adapter
lib/Mongo/MongoCursor.php
MongoCursor.explain
public function explain() { $optionNames = [ 'allowPartialResults', 'batchSize', 'cursorType', 'limit', 'maxTimeMS', 'noCursorTimeout', 'projection', 'skip', 'sort', ]; $options = $th...
php
public function explain() { $optionNames = [ 'allowPartialResults', 'batchSize', 'cursorType', 'limit', 'maxTimeMS', 'noCursorTimeout', 'projection', 'skip', 'sort', ]; $options = $th...
[ "public", "function", "explain", "(", ")", "{", "$", "optionNames", "=", "[", "'allowPartialResults'", ",", "'batchSize'", ",", "'cursorType'", ",", "'limit'", ",", "'maxTimeMS'", ",", "'noCursorTimeout'", ",", "'projection'", ",", "'skip'", ",", "'sort'", ",", ...
Return an explanation of the query, often useful for optimization and debugging @link http://www.php.net/manual/en/mongocursor.explain.php @return array Returns an explanation of the query.
[ "Return", "an", "explanation", "of", "the", "query", "often", "useful", "for", "optimization", "and", "debugging" ]
train
https://github.com/alcaeus/mongo-php-adapter/blob/b4c2f0d30dbddd624d3bc2a27175e6eb602241d4/lib/Mongo/MongoCursor.php#L179-L206