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/activity_creator/src/ActivityFactory.php
ActivityFactory.getFieldRecipientGroup
protected function getFieldRecipientGroup($data) { $value = NULL; if (isset($data['recipient'])) { if ($data['recipient']['target_type'] === 'group') { // Should be in an array for the field. $value = [$data['recipient']]; } } return $value; }
php
protected function getFieldRecipientGroup($data) { $value = NULL; if (isset($data['recipient'])) { if ($data['recipient']['target_type'] === 'group') { // Should be in an array for the field. $value = [$data['recipient']]; } } return $value; }
[ "protected", "function", "getFieldRecipientGroup", "(", "$", "data", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "data", "[", "'recipient'", "]", ")", ")", "{", "if", "(", "$", "data", "[", "'recipient'", "]", "[", "'targe...
Get field value for 'recipient_group' field from data array.
[ "Get", "field", "value", "for", "recipient_group", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L350-L359
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getFieldRecipientUser
protected function getFieldRecipientUser($data) { $value = NULL; if (isset($data['recipient']) && is_array($data['recipient'])) { if ($data['recipient']['target_type'] === 'user') { // Should be in an array for the field. $value = [$data['recipient']]; } } return $value; }
php
protected function getFieldRecipientUser($data) { $value = NULL; if (isset($data['recipient']) && is_array($data['recipient'])) { if ($data['recipient']['target_type'] === 'user') { // Should be in an array for the field. $value = [$data['recipient']]; } } return $value; }
[ "protected", "function", "getFieldRecipientUser", "(", "$", "data", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "data", "[", "'recipient'", "]", ")", "&&", "is_array", "(", "$", "data", "[", "'recipient'", "]", ")", ")", "...
Get field value for 'recipient_user' field from data array.
[ "Get", "field", "value", "for", "recipient_user", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L364-L373
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getMessageText
public function getMessageText(Message $message, $langcode = '') { /** @var \Drupal\message\Entity\MessageTemplate $message_template */ $message_template = $message->getTemplate(); $message_arguments = $message->getArguments(); $message_template_text = $message_template->get('text'); // If we have...
php
public function getMessageText(Message $message, $langcode = '') { /** @var \Drupal\message\Entity\MessageTemplate $message_template */ $message_template = $message->getTemplate(); $message_arguments = $message->getArguments(); $message_template_text = $message_template->get('text'); // If we have...
[ "public", "function", "getMessageText", "(", "Message", "$", "message", ",", "$", "langcode", "=", "''", ")", "{", "/** @var \\Drupal\\message\\Entity\\MessageTemplate $message_template */", "$", "message_template", "=", "$", "message", "->", "getTemplate", "(", ")", ...
Get message text. @param \Drupal\message\Entity\Message $message Message object we get the text for. @param string $langcode The language code we try to get the translation for. @return array Message text array.
[ "Get", "message", "text", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L403-L434
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.processArguments
protected function processArguments(array $arguments, array $output, Message $message) { // Check if we have arguments saved along with the message. if (empty($arguments)) { return $output; } foreach ($arguments as $key => $value) { if (is_array($value) && !empty($value['callback']) && is_c...
php
protected function processArguments(array $arguments, array $output, Message $message) { // Check if we have arguments saved along with the message. if (empty($arguments)) { return $output; } foreach ($arguments as $key => $value) { if (is_array($value) && !empty($value['callback']) && is_c...
[ "protected", "function", "processArguments", "(", "array", "$", "arguments", ",", "array", "$", "output", ",", "Message", "$", "message", ")", "{", "// Check if we have arguments saved along with the message.", "if", "(", "empty", "(", "$", "arguments", ")", ")", ...
Process the message given the arguments saved with it. @param array $arguments Array with the arguments. @param array $output Array with the templated text saved in the message template. @param \Drupal\message\Entity\Message $message Message object. @return array The templated text, with the placeholders replaced wit...
[ "Process", "the", "message", "given", "the", "arguments", "saved", "with", "it", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L450-L476
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.processTokens
protected function processTokens(array $output, $clear, Message $message) { $options = [ 'clear' => $clear, ]; foreach ($output as $key => $value) { if (is_string($value)) { $output[$key] = \Drupal::token() ->replace($value, ['message' => $message], $options); } el...
php
protected function processTokens(array $output, $clear, Message $message) { $options = [ 'clear' => $clear, ]; foreach ($output as $key => $value) { if (is_string($value)) { $output[$key] = \Drupal::token() ->replace($value, ['message' => $message], $options); } el...
[ "protected", "function", "processTokens", "(", "array", "$", "output", ",", "$", "clear", ",", "Message", "$", "message", ")", "{", "$", "options", "=", "[", "'clear'", "=>", "$", "clear", ",", "]", ";", "foreach", "(", "$", "output", "as", "$", "key...
Replace placeholders with tokens. @param array $output The templated text to be replaced. @param bool $clear Determine if unused token should be cleared. @param \Drupal\message\Entity\Message $message Message object. @return array The output with placeholders replaced with the token value, if there are indeed tokens.
[ "Replace", "placeholders", "with", "tokens", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L492-L511
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php
GroupAddTopicBlock.build
public function build() { $build = []; $group = _social_group_get_current_group(); if (is_object($group)) { $url = Url::fromUserInput("/group/{$group->id()}/content/create/group_node:topic"); $link_options = [ 'attributes' => [ 'class' => [ 'btn', 'bt...
php
public function build() { $build = []; $group = _social_group_get_current_group(); if (is_object($group)) { $url = Url::fromUserInput("/group/{$group->id()}/content/create/group_node:topic"); $link_options = [ 'attributes' => [ 'class' => [ 'btn', 'bt...
[ "public", "function", "build", "(", ")", "{", "$", "build", "=", "[", "]", ";", "$", "group", "=", "_social_group_get_current_group", "(", ")", ";", "if", "(", "is_object", "(", "$", "group", ")", ")", "{", "$", "url", "=", "Url", "::", "fromUserInpu...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Block/GroupAddTopicBlock.php#L48-L77
goalgorilla/open_social
modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php
Immediately.processItem
public function processItem(Activity $activity, Message $message, User $target) { if ($target->isBlocked()) { return; } // Continue if we have text to send and the user is currently offline. if (isset($activity->field_activity_output_text) && EmailActivityDestination::isUserOffline($target)) { ...
php
public function processItem(Activity $activity, Message $message, User $target) { if ($target->isBlocked()) { return; } // Continue if we have text to send and the user is currently offline. if (isset($activity->field_activity_output_text) && EmailActivityDestination::isUserOffline($target)) { ...
[ "public", "function", "processItem", "(", "Activity", "$", "activity", ",", "Message", "$", "message", ",", "User", "$", "target", ")", "{", "if", "(", "$", "target", "->", "isBlocked", "(", ")", ")", "{", "return", ";", "}", "// Continue if we have text t...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php#L28-L42
goalgorilla/open_social
modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php
Immediately.sendEmail
protected function sendEmail($body_text, $langcode, User $target) { // Translating frequency instance in the language of the user. // @codingStandardsIgnoreStart $frequency_translated = t($this->getName()->getUntranslatedString(), [], ['langcode' => $langcode]); // @codingStandardsIgnoreEnd // Cons...
php
protected function sendEmail($body_text, $langcode, User $target) { // Translating frequency instance in the language of the user. // @codingStandardsIgnoreStart $frequency_translated = t($this->getName()->getUntranslatedString(), [], ['langcode' => $langcode]); // @codingStandardsIgnoreEnd // Cons...
[ "protected", "function", "sendEmail", "(", "$", "body_text", ",", "$", "langcode", ",", "User", "$", "target", ")", "{", "// Translating frequency instance in the language of the user.", "// @codingStandardsIgnoreStart", "$", "frequency_translated", "=", "t", "(", "$", ...
Send an email with a single notification. @param string $body_text The text to send to the target user. @param string $langcode The langcode of the target user. @param \Drupal\user\Entity\User $target The target account to send the email to.
[ "Send", "an", "email", "with", "a", "single", "notification", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php#L54-L84
goalgorilla/open_social
modules/social_features/social_event/src/Service/SocialEventEnrollService.php
SocialEventEnrollService.isEnabled
public function isEnabled(NodeInterface $node) { if ($node->bundle() === 'event') { $was_not_changed = $node->field_event_enroll->isEmpty(); $is_enabled = $node->field_event_enroll->value; return $was_not_changed || $is_enabled; } return FALSE; }
php
public function isEnabled(NodeInterface $node) { if ($node->bundle() === 'event') { $was_not_changed = $node->field_event_enroll->isEmpty(); $is_enabled = $node->field_event_enroll->value; return $was_not_changed || $is_enabled; } return FALSE; }
[ "public", "function", "isEnabled", "(", "NodeInterface", "$", "node", ")", "{", "if", "(", "$", "node", "->", "bundle", "(", ")", "===", "'event'", ")", "{", "$", "was_not_changed", "=", "$", "node", "->", "field_event_enroll", "->", "isEmpty", "(", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Service/SocialEventEnrollService.php#L17-L26
goalgorilla/open_social
modules/social_features/social_group/src/Form/SocialGroupAddForm.php
SocialGroupAddForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { if ($group_type = $form_state->getValue('group_type')) { $url = Url::fromUserInput('/group/add/' . $group_type); $form_state->setRedirectUrl($url); } }
php
public function submitForm(array &$form, FormStateInterface $form_state) { if ($group_type = $form_state->getValue('group_type')) { $url = Url::fromUserInput('/group/add/' . $group_type); $form_state->setRedirectUrl($url); } }
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "if", "(", "$", "group_type", "=", "$", "form_state", "->", "getValue", "(", "'group_type'", ")", ")", "{", "$", "url", "=", "Url"...
Form submission handler. @param array $form An associative array containing the structure of the form. @param \Drupal\Core\Form\FormStateInterface $form_state The current state of the form.
[ "Form", "submission", "handler", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Form/SocialGroupAddForm.php#L71-L77
goalgorilla/open_social
modules/social_features/social_group/src/Form/SocialGroupAddForm.php
SocialGroupAddForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $form['#attributes']['class'][] = 'form--default'; $form['group_settings'] = [ '#type' => 'fieldset', '#title' => $this->t('Settings'), ]; $form['group_settings']['group_type'] = $this->getGroupTypeElement(); $form[...
php
public function buildForm(array $form, FormStateInterface $form_state) { $form['#attributes']['class'][] = 'form--default'; $form['group_settings'] = [ '#type' => 'fieldset', '#title' => $this->t('Settings'), ]; $form['group_settings']['group_type'] = $this->getGroupTypeElement(); $form[...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form", "[", "'#attributes'", "]", "[", "'class'", "]", "[", "]", "=", "'form--default'", ";", "$", "form", "[", "'group_settings'", ...
Defines the settings form for Post entities. @param array $form An associative array containing the structure of the form. @param \Drupal\Core\Form\FormStateInterface $form_state The current state of the form. @return array Form definition array.
[ "Defines", "the", "settings", "form", "for", "Post", "entities", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Form/SocialGroupAddForm.php#L90-L108
goalgorilla/open_social
modules/social_features/social_group/src/Form/SocialGroupAddForm.php
SocialGroupAddForm.getGroupTypeElement
public function getGroupTypeElement() { $user = \Drupal::currentUser(); $element = [ '#type' => 'radios', '#title' => $this->t('Group type'), '#default_value' => 'open_group', '#required' => TRUE, '#cache' => [ 'tags' => $this->entityTypeManager->getDefinition('group_type')...
php
public function getGroupTypeElement() { $user = \Drupal::currentUser(); $element = [ '#type' => 'radios', '#title' => $this->t('Group type'), '#default_value' => 'open_group', '#required' => TRUE, '#cache' => [ 'tags' => $this->entityTypeManager->getDefinition('group_type')...
[ "public", "function", "getGroupTypeElement", "(", ")", "{", "$", "user", "=", "\\", "Drupal", "::", "currentUser", "(", ")", ";", "$", "element", "=", "[", "'#type'", "=>", "'radios'", ",", "'#title'", "=>", "$", "this", "->", "t", "(", "'Group type'", ...
Get the group type element. Note this element is also used in the edit group form. @return array Returns an array containing the group type element and descriptions.
[ "Get", "the", "group", "type", "element", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Form/SocialGroupAddForm.php#L118-L153
goalgorilla/open_social
modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/EntityTypeCount.php
EntityTypeCount.getValue
public function getValue() { $value = []; $definitions = $this->entityTypeManager->getDefinitions(); foreach ($definitions as $definition) { $entity_type_id = $definition->id(); // We don't need to add config entities. if ($definition instanceof ConfigEntityType) { continue; ...
php
public function getValue() { $value = []; $definitions = $this->entityTypeManager->getDefinitions(); foreach ($definitions as $definition) { $entity_type_id = $definition->id(); // We don't need to add config entities. if ($definition instanceof ConfigEntityType) { continue; ...
[ "public", "function", "getValue", "(", ")", "{", "$", "value", "=", "[", "]", ";", "$", "definitions", "=", "$", "this", "->", "entityTypeManager", "->", "getDefinitions", "(", ")", ";", "foreach", "(", "$", "definitions", "as", "$", "definition", ")", ...
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/EntityTypeCount.php#L26-L77
goalgorilla/open_social
modules/social_features/social_comment/src/Routing/RouteSubscriber.php
RouteSubscriber.alterRoutes
public function alterRoutes(RouteCollection $collection) { // Redirect comment/comment page to entity if applicable. $config = \Drupal::config('social_comment.comment_settings'); $redirect_comment_to_entity = $config->get('redirect_comment_to_entity'); /** @var \Symfony\Component\Routing\Route $route *...
php
public function alterRoutes(RouteCollection $collection) { // Redirect comment/comment page to entity if applicable. $config = \Drupal::config('social_comment.comment_settings'); $redirect_comment_to_entity = $config->get('redirect_comment_to_entity'); /** @var \Symfony\Component\Routing\Route $route *...
[ "public", "function", "alterRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "// Redirect comment/comment page to entity if applicable.", "$", "config", "=", "\\", "Drupal", "::", "config", "(", "'social_comment.comment_settings'", ")", ";", "$", "redirect_co...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/Routing/RouteSubscriber.php#L16-L49
goalgorilla/open_social
modules/social_features/social_event/src/Form/EventEnrollmentForm.php
EventEnrollmentForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { /* @var $entity \Drupal\social_event\Entity\EventEnrollment */ $form = parent::buildForm($form, $form_state); return $form; }
php
public function buildForm(array $form, FormStateInterface $form_state) { /* @var $entity \Drupal\social_event\Entity\EventEnrollment */ $form = parent::buildForm($form, $form_state); return $form; }
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "/* @var $entity \\Drupal\\social_event\\Entity\\EventEnrollment */", "$", "form", "=", "parent", "::", "buildForm", "(", "$", "form", ",", "$", "fo...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Form/EventEnrollmentForm.php#L18-L23
goalgorilla/open_social
modules/social_features/social_post/src/Form/PostDeleteForm.php
PostDeleteForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); // Set the redirect url of the cancel button. if (\Drupal::request()->query->has('destination')) { $destination = \Drupal::destination(); $path = $destination->get(); $f...
php
public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); // Set the redirect url of the cancel button. if (\Drupal::request()->query->has('destination')) { $destination = \Drupal::destination(); $path = $destination->get(); $f...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form", "=", "parent", "::", "buildForm", "(", "$", "form", ",", "$", "form_state", ")", ";", "// Set the redirect url of the cancel button...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Form/PostDeleteForm.php#L19-L34
goalgorilla/open_social
modules/social_features/social_post/src/Form/PostDeleteForm.php
PostDeleteForm.getRedirectUrl
public function getRedirectUrl() { // Set the redirect url to the destination in the url. if (\Drupal::request()->query->has('destination')) { $destination = \Drupal::destination(); $path = $destination->get(); return Url::fromUserInput($path); } // Default to the stream page. retu...
php
public function getRedirectUrl() { // Set the redirect url to the destination in the url. if (\Drupal::request()->query->has('destination')) { $destination = \Drupal::destination(); $path = $destination->get(); return Url::fromUserInput($path); } // Default to the stream page. retu...
[ "public", "function", "getRedirectUrl", "(", ")", "{", "// Set the redirect url to the destination in the url.", "if", "(", "\\", "Drupal", "::", "request", "(", ")", "->", "query", "->", "has", "(", "'destination'", ")", ")", "{", "$", "destination", "=", "\\",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Form/PostDeleteForm.php#L39-L48
goalgorilla/open_social
modules/custom/social_demo/src/DemoComment.php
DemoComment.createContent
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Comment with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
php
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Comment with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
[ "public", "function", "createContent", "(", ")", "{", "$", "data", "=", "$", "this", "->", "fetchData", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "uuid", "=>", "$", "item", ")", "{", "// Must have uuid and same key value.", "if", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoComment.php#L49-L126
goalgorilla/open_social
modules/custom/social_demo/src/DemoComment.php
DemoComment.getEntry
protected function getEntry(array $item) { $entry = [ 'uuid' => $item['uuid'], 'field_comment_body' => [ [ 'value' => $this->checkMentionOrLinkByUuid($item['body']), 'format' => 'basic_html', ], ], 'langcode' => $item['langcode'], 'uid' => $item['uid...
php
protected function getEntry(array $item) { $entry = [ 'uuid' => $item['uuid'], 'field_comment_body' => [ [ 'value' => $this->checkMentionOrLinkByUuid($item['body']), 'format' => 'basic_html', ], ], 'langcode' => $item['langcode'], 'uid' => $item['uid...
[ "protected", "function", "getEntry", "(", "array", "$", "item", ")", "{", "$", "entry", "=", "[", "'uuid'", "=>", "$", "item", "[", "'uuid'", "]", ",", "'field_comment_body'", "=>", "[", "[", "'value'", "=>", "$", "this", "->", "checkMentionOrLinkByUuid", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoComment.php#L153-L175
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/views/argument/UserUid.php
UserUid.query
public function query($group_by = FALSE) { $this->ensureMyTable(); // Use the table definition to correctly add this user ID condition. if ($this->table != 'group_content_field_data') { $subselect2 = $this->database->select('group_content_field_data', 'gc'); $subselect2->addField('gc', 'gid'); ...
php
public function query($group_by = FALSE) { $this->ensureMyTable(); // Use the table definition to correctly add this user ID condition. if ($this->table != 'group_content_field_data') { $subselect2 = $this->database->select('group_content_field_data', 'gc'); $subselect2->addField('gc', 'gid'); ...
[ "public", "function", "query", "(", "$", "group_by", "=", "FALSE", ")", "{", "$", "this", "->", "ensureMyTable", "(", ")", ";", "// Use the table definition to correctly add this user ID condition.", "if", "(", "$", "this", "->", "table", "!=", "'group_content_field...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/views/argument/UserUid.php#L56-L74
goalgorilla/open_social
modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php
SocialGroupListBuilder.createInstance
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, $container->get('entity_type.manager')->getStorage($entity_type->id()), $container->get('redirect.destination'), $container->get('date.formatter') ); ...
php
public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, $container->get('entity_type.manager')->getStorage($entity_type->id()), $container->get('redirect.destination'), $container->get('date.formatter') ); ...
[ "public", "static", "function", "createInstance", "(", "ContainerInterface", "$", "container", ",", "EntityTypeInterface", "$", "entity_type", ")", "{", "return", "new", "static", "(", "$", "entity_type", ",", "$", "container", "->", "get", "(", "'entity_type.mana...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php#L55-L62
goalgorilla/open_social
modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php
SocialGroupListBuilder.buildRow
public function buildRow(EntityInterface $entity) { /** @var \Drupal\group\Entity\GroupInterface $entity */ // EntityListBuilder sets the table rows using the #rows property, so we // need to add the render array using the 'data' key. $row['name']['data'] = $entity->toLink()->toRenderable(); $row['t...
php
public function buildRow(EntityInterface $entity) { /** @var \Drupal\group\Entity\GroupInterface $entity */ // EntityListBuilder sets the table rows using the #rows property, so we // need to add the render array using the 'data' key. $row['name']['data'] = $entity->toLink()->toRenderable(); $row['t...
[ "public", "function", "buildRow", "(", "EntityInterface", "$", "entity", ")", "{", "/** @var \\Drupal\\group\\Entity\\GroupInterface $entity */", "// EntityListBuilder sets the table rows using the #rows property, so we", "// need to add the render array using the 'data' key.", "$", "row",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php#L101-L112
goalgorilla/open_social
modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php
SocialGroupListBuilder.getEntityIds
protected function getEntityIds() { $query = $this->getStorage()->getQuery(); // Add table sorting functionality. $headers = $this->buildHeader(); $query->tableSort($headers); // Only add the pager if a limit is specified. if ($this->limit) { $query->pager($this->limit); } return...
php
protected function getEntityIds() { $query = $this->getStorage()->getQuery(); // Add table sorting functionality. $headers = $this->buildHeader(); $query->tableSort($headers); // Only add the pager if a limit is specified. if ($this->limit) { $query->pager($this->limit); } return...
[ "protected", "function", "getEntityIds", "(", ")", "{", "$", "query", "=", "$", "this", "->", "getStorage", "(", ")", "->", "getQuery", "(", ")", ";", "// Add table sorting functionality.", "$", "headers", "=", "$", "this", "->", "buildHeader", "(", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php#L117-L129
goalgorilla/open_social
modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php
SocialGroupListBuilder.getDefaultOperations
protected function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); // Add the current path or destination as a redirect to the operation links. $destination = $this->redirectDestination->getAsArray(); foreach ($operations as $key => $operation) { ...
php
protected function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); // Add the current path or destination as a redirect to the operation links. $destination = $this->redirectDestination->getAsArray(); foreach ($operations as $key => $operation) { ...
[ "protected", "function", "getDefaultOperations", "(", "EntityInterface", "$", "entity", ")", "{", "$", "operations", "=", "parent", "::", "getDefaultOperations", "(", "$", "entity", ")", ";", "// Add the current path or destination as a redirect to the operation links.", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Controller/SocialGroupListBuilder.php#L143-L153
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_managers/src/Form/SocialEventManagementViewsBulkOperationsConfigureAction.php
SocialEventManagementViewsBulkOperationsConfigureAction.buildForm
public function buildForm(array $form, FormStateInterface $form_state, $view_id = 'event_manage_enrollments', $display_id = 'page_manage_enrollments') { return parent::buildForm($form, $form_state, 'event_manage_enrollments', 'page_manage_enrollments'); }
php
public function buildForm(array $form, FormStateInterface $form_state, $view_id = 'event_manage_enrollments', $display_id = 'page_manage_enrollments') { return parent::buildForm($form, $form_state, 'event_manage_enrollments', 'page_manage_enrollments'); }
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ",", "$", "view_id", "=", "'event_manage_enrollments'", ",", "$", "display_id", "=", "'page_manage_enrollments'", ")", "{", "return", "parent", "::", "build...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_managers/src/Form/SocialEventManagementViewsBulkOperationsConfigureAction.php#L16-L18
goalgorilla/open_social
modules/social_features/social_group/src/SocialGroupSelectorWidgetConfigOverride.php
SocialGroupSelectorWidgetConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_names = [ 'core.entity_form_display.node.event.default', 'core.entity_form_display.node.topic.default', ]; foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service...
php
public function loadOverrides($names) { $overrides = []; $config_names = [ 'core.entity_form_display.node.event.default', 'core.entity_form_display.node.topic.default', ]; foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_names", "=", "[", "'core.entity_form_display.node.event.default'", ",", "'core.entity_form_display.node.topic.default'", ",", "]", ";", "foreach", ...
Load overrides.
[ "Load", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SocialGroupSelectorWidgetConfigOverride.php#L19-L45
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/MenuLink.php
MenuLink.getEntry
public function getEntry(array $item) { $entry = parent::getEntry($item); return $entry + [ 'title' => $item['title'], 'link' => [ 'uri' => $item['link'], ], 'menu_name' => $item['menu_name'], 'expanded' => $item['expanded'], 'weight' => isset($item['weight']) ? $ite...
php
public function getEntry(array $item) { $entry = parent::getEntry($item); return $entry + [ 'title' => $item['title'], 'link' => [ 'uri' => $item['link'], ], 'menu_name' => $item['menu_name'], 'expanded' => $item['expanded'], 'weight' => isset($item['weight']) ? $ite...
[ "public", "function", "getEntry", "(", "array", "$", "item", ")", "{", "$", "entry", "=", "parent", "::", "getEntry", "(", "$", "item", ")", ";", "return", "$", "entry", "+", "[", "'title'", "=>", "$", "item", "[", "'title'", "]", ",", "'link'", "=...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/MenuLink.php#L22-L34
goalgorilla/open_social
modules/custom/social_demo/src/DemoNode.php
DemoNode.createContent
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Node with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
php
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Node with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
[ "public", "function", "createContent", "(", ")", "{", "$", "data", "=", "$", "this", "->", "fetchData", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "uuid", "=>", "$", "item", ")", "{", "// Must have uuid and same key value.", "if", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoNode.php#L63-L119
goalgorilla/open_social
modules/custom/social_demo/src/DemoNode.php
DemoNode.createGroupContent
public function createGroupContent(NodeInterface $entity, $uuid) { // Load the group. $groups = $this->groupStorage->loadByProperties([ 'uuid' => $uuid, ]); if ($groups) { $group = current($groups); // Get the group content plugin. $plugin_id = 'group_node:' . $entity->bundle();...
php
public function createGroupContent(NodeInterface $entity, $uuid) { // Load the group. $groups = $this->groupStorage->loadByProperties([ 'uuid' => $uuid, ]); if ($groups) { $group = current($groups); // Get the group content plugin. $plugin_id = 'group_node:' . $entity->bundle();...
[ "public", "function", "createGroupContent", "(", "NodeInterface", "$", "entity", ",", "$", "uuid", ")", "{", "// Load the group.", "$", "groups", "=", "$", "this", "->", "groupStorage", "->", "loadByProperties", "(", "[", "'uuid'", "=>", "$", "uuid", ",", "]...
Creates a group content. @param \Drupal\node\NodeInterface $entity Object of a node. @param string $uuid UUID of a group.
[ "Creates", "a", "group", "content", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoNode.php#L171-L189
goalgorilla/open_social
modules/custom/social_demo/src/DemoNode.php
DemoNode.createFollow
public function createFollow(Entity $entity, array $uuids) { foreach ($uuids as $uuid) { // Load the user(s) by the given uuid(s). $account = $this->loadByUuid('user', $uuid); $properties = [ 'uid' => $account->id(), 'entity_type' => 'node', 'entity_id' => $entity->id(), ...
php
public function createFollow(Entity $entity, array $uuids) { foreach ($uuids as $uuid) { // Load the user(s) by the given uuid(s). $account = $this->loadByUuid('user', $uuid); $properties = [ 'uid' => $account->id(), 'entity_type' => 'node', 'entity_id' => $entity->id(), ...
[ "public", "function", "createFollow", "(", "Entity", "$", "entity", ",", "array", "$", "uuids", ")", "{", "foreach", "(", "$", "uuids", "as", "$", "uuid", ")", "{", "// Load the user(s) by the given uuid(s).", "$", "account", "=", "$", "this", "->", "loadByU...
The function that checks and creates a follow on an entity. @param \Drupal\Core\Entity\Entity $entity The related entity. @param array $uuids The array containing uuids.
[ "The", "function", "that", "checks", "and", "creates", "a", "follow", "on", "an", "entity", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoNode.php#L199-L228
goalgorilla/open_social
modules/custom/social_auth_google/src/Controller/GoogleLinkController.php
GoogleLinkController.linkAccount
public function linkAccount() { $sdk = $this->getSdk(); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); $url = $this->authManager->getAuthenticationUrl('link'); return new TrustedRedirectResponse($url); }
php
public function linkAccount() { $sdk = $this->getSdk(); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); $url = $this->authManager->getAuthenticationUrl('link'); return new TrustedRedirectResponse($url); }
[ "public", "function", "linkAccount", "(", ")", "{", "$", "sdk", "=", "$", "this", "->", "getSdk", "(", ")", ";", "if", "(", "$", "sdk", "instanceof", "RedirectResponse", ")", "{", "return", "$", "sdk", ";", "}", "$", "this", "->", "authManager", "->"...
Response for path 'social-api/link/google'. Redirects the user to Google for joining accounts.
[ "Response", "for", "path", "social", "-", "api", "/", "link", "/", "google", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/Controller/GoogleLinkController.php#L46-L57
goalgorilla/open_social
modules/custom/social_auth_google/src/Controller/GoogleLinkController.php
GoogleLinkController.linkAccountCallback
public function linkAccountCallback() { $sdk = $this->getSdk(); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); // Get the OAuth token from Google. if (!$this->authManager->getAccessToken('link')) { drupal_set_message($this->t('@network log...
php
public function linkAccountCallback() { $sdk = $this->getSdk(); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); // Get the OAuth token from Google. if (!$this->authManager->getAccessToken('link')) { drupal_set_message($this->t('@network log...
[ "public", "function", "linkAccountCallback", "(", ")", "{", "$", "sdk", "=", "$", "this", "->", "getSdk", "(", ")", ";", "if", "(", "$", "sdk", "instanceof", "RedirectResponse", ")", "{", "return", "$", "sdk", ";", "}", "$", "this", "->", "authManager"...
Makes joining between account on this site and account on social network. @return \Symfony\Component\HttpFoundation\RedirectResponse A RedirectResponse pointing to the user edit form.
[ "Makes", "joining", "between", "account", "on", "this", "site", "and", "account", "on", "social", "network", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/Controller/GoogleLinkController.php#L65-L120
goalgorilla/open_social
modules/custom/social_auth_google/src/Controller/GoogleLinkController.php
GoogleLinkController.getSdk
public function getSdk() { $network_manager = $this->networkManager->createInstance('social_auth_google'); if (!$network_manager->isActive()) { drupal_set_message($this->t('@network is disallowed. Contact site administrator.', [ '@network' => $this->t('Google'), ]), 'error'); return $...
php
public function getSdk() { $network_manager = $this->networkManager->createInstance('social_auth_google'); if (!$network_manager->isActive()) { drupal_set_message($this->t('@network is disallowed. Contact site administrator.', [ '@network' => $this->t('Google'), ]), 'error'); return $...
[ "public", "function", "getSdk", "(", ")", "{", "$", "network_manager", "=", "$", "this", "->", "networkManager", "->", "createInstance", "(", "'social_auth_google'", ")", ";", "if", "(", "!", "$", "network_manager", "->", "isActive", "(", ")", ")", "{", "d...
Returns the SDK instance or RedirectResponse when error occurred. @return mixed|\Symfony\Component\HttpFoundation\RedirectResponse Can return an SDK instance or a RedirectResponse to the user edit form.
[ "Returns", "the", "SDK", "instance", "or", "RedirectResponse", "when", "error", "occurred", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/Controller/GoogleLinkController.php#L128-L150
goalgorilla/open_social
modules/custom/group_core_comments/src/GroupCommentAccessControlHandler.php
GroupCommentAccessControlHandler.checkAccess
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\comment\CommentInterface|\Drupal\user\EntityOwnerInterface $entity */ $parent_access = parent::checkAccess($entity, $operation, $account); $commented_entity = $entity->getCommentedEntity(); ...
php
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\comment\CommentInterface|\Drupal\user\EntityOwnerInterface $entity */ $parent_access = parent::checkAccess($entity, $operation, $account); $commented_entity = $entity->getCommentedEntity(); ...
[ "protected", "function", "checkAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "/** @var \\Drupal\\comment\\CommentInterface|\\Drupal\\user\\EntityOwnerInterface $entity */", "$", "parent_access", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/group_core_comments/src/GroupCommentAccessControlHandler.php#L23-L64
goalgorilla/open_social
modules/custom/group_core_comments/src/GroupCommentAccessControlHandler.php
GroupCommentAccessControlHandler.getPermissionInGroups
protected function getPermissionInGroups($perm, AccountInterface $account, $group_contents) { // Only when you have permission to view the comments. foreach ($group_contents as $group_content) { /** @var \Drupal\group\Entity\GroupContent $group_content */ $group = $group_content->getGroup(); ...
php
protected function getPermissionInGroups($perm, AccountInterface $account, $group_contents) { // Only when you have permission to view the comments. foreach ($group_contents as $group_content) { /** @var \Drupal\group\Entity\GroupContent $group_content */ $group = $group_content->getGroup(); ...
[ "protected", "function", "getPermissionInGroups", "(", "$", "perm", ",", "AccountInterface", "$", "account", ",", "$", "group_contents", ")", "{", "// Only when you have permission to view the comments.", "foreach", "(", "$", "group_contents", "as", "$", "group_content", ...
Checks if account was granted permission in group.
[ "Checks", "if", "account", "was", "granted", "permission", "in", "group", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/group_core_comments/src/GroupCommentAccessControlHandler.php#L69-L82
goalgorilla/open_social
modules/social_features/social_post/src/Entity/Post.php
Post.preCreate
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) { parent::preCreate($storage_controller, $values); $values += [ 'user_id' => \Drupal::currentUser()->id(), ]; }
php
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) { parent::preCreate($storage_controller, $values); $values += [ 'user_id' => \Drupal::currentUser()->id(), ]; }
[ "public", "static", "function", "preCreate", "(", "EntityStorageInterface", "$", "storage_controller", ",", "array", "&", "$", "values", ")", "{", "parent", "::", "preCreate", "(", "$", "storage_controller", ",", "$", "values", ")", ";", "$", "values", "+=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Entity/Post.php#L67-L72
goalgorilla/open_social
modules/social_features/social_post/src/Entity/Post.php
Post.getVisibility
public function getVisibility() { if ($this->hasField('field_visibility')) { switch ($this->field_visibility->value) { case "0": case "2": $visibility = 'community'; break; case "1": $visibility = 'public'; break; case "3": $...
php
public function getVisibility() { if ($this->hasField('field_visibility')) { switch ($this->field_visibility->value) { case "0": case "2": $visibility = 'community'; break; case "1": $visibility = 'public'; break; case "3": $...
[ "public", "function", "getVisibility", "(", ")", "{", "if", "(", "$", "this", "->", "hasField", "(", "'field_visibility'", ")", ")", "{", "switch", "(", "$", "this", "->", "field_visibility", "->", "value", ")", "{", "case", "\"0\"", ":", "case", "\"2\""...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Entity/Post.php#L163-L183
goalgorilla/open_social
modules/social_features/social_post/src/Entity/Post.php
Post.setVisibility
public function setVisibility($visibility) { if ($this->hasField('field_visibility')) { switch ($visibility) { case 'community': $this->set('field_visibility', 0); break; case 'public': $this->set('field_visibility', 1); break; case "group": ...
php
public function setVisibility($visibility) { if ($this->hasField('field_visibility')) { switch ($visibility) { case 'community': $this->set('field_visibility', 0); break; case 'public': $this->set('field_visibility', 1); break; case "group": ...
[ "public", "function", "setVisibility", "(", "$", "visibility", ")", "{", "if", "(", "$", "this", "->", "hasField", "(", "'field_visibility'", ")", ")", "{", "switch", "(", "$", "visibility", ")", "{", "case", "'community'", ":", "$", "this", "->", "set",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Entity/Post.php#L188-L207
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('system.site'); // We create a fieldset for the default username login. $form['username_login'] = [ '#type' => 'fieldset', '#title' => $this->t('Log in with <b>username</b> or <b>email</b>'), ];...
php
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('system.site'); // We create a fieldset for the default username login. $form['username_login'] = [ '#type' => 'fieldset', '#title' => $this->t('Log in with <b>username</b> or <b>email</b>'), ];...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "config", "=", "$", "this", "->", "config", "(", "'system.site'", ")", ";", "// We create a fieldset for the default username login.", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L34-L114
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { $account = $this->userStorage->load($form_state->get('uid')); // A destination was set, probably on an exception controller,. // @TODO: Add validation if route exists. if (!$this->getRequest()->request->has('destination')) { ...
php
public function submitForm(array &$form, FormStateInterface $form_state) { $account = $this->userStorage->load($form_state->get('uid')); // A destination was set, probably on an exception controller,. // @TODO: Add validation if route exists. if (!$this->getRequest()->request->has('destination')) { ...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "account", "=", "$", "this", "->", "userStorage", "->", "load", "(", "$", "form_state", "->", "get", "(", "'uid'", ")", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L119-L131
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.validateNameMail
public function validateNameMail(array &$form, FormStateInterface $form_state) { $user_blocked = social_user_is_blocked($form_state->getValue('name_or_mail')); if ($user_blocked) { // Blocked in user administration. if (!$form_state->get('uid')) { $this->setGeneralErrorMessage($form, $form_s...
php
public function validateNameMail(array &$form, FormStateInterface $form_state) { $user_blocked = social_user_is_blocked($form_state->getValue('name_or_mail')); if ($user_blocked) { // Blocked in user administration. if (!$form_state->get('uid')) { $this->setGeneralErrorMessage($form, $form_s...
[ "public", "function", "validateNameMail", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "user_blocked", "=", "social_user_is_blocked", "(", "$", "form_state", "->", "getValue", "(", "'name_or_mail'", ")", ")", ";", ...
Sets an error if supplied username or mail has been blocked.
[ "Sets", "an", "error", "if", "supplied", "username", "or", "mail", "has", "been", "blocked", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L136-L147
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.validateAuthentication
public function validateAuthentication(array &$form, FormStateInterface $form_state) { $password = trim($form_state->getValue('pass')); $flood_config = $this->config('user.flood'); if (!$form_state->isValueEmpty('name_or_mail') && strlen($password) > 0) { // Do not allow any login from the current use...
php
public function validateAuthentication(array &$form, FormStateInterface $form_state) { $password = trim($form_state->getValue('pass')); $flood_config = $this->config('user.flood'); if (!$form_state->isValueEmpty('name_or_mail') && strlen($password) > 0) { // Do not allow any login from the current use...
[ "public", "function", "validateAuthentication", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "password", "=", "trim", "(", "$", "form_state", "->", "getValue", "(", "'pass'", ")", ")", ";", "$", "flood_config",...
Checks supplied username/password against local users table. If successful, $form_state->get('uid') is set to the matching user ID.
[ "Checks", "supplied", "username", "/", "password", "against", "local", "users", "table", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L154-L204
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.validateFinal
public function validateFinal(array &$form, FormStateInterface $form_state) { $flood_config = $this->config('user.flood'); if (!$form_state->get('uid')) { // Set general error message to not leak privacy information. $this->setGeneralErrorMessage($form, $form_state); // Always register an IP-...
php
public function validateFinal(array &$form, FormStateInterface $form_state) { $flood_config = $this->config('user.flood'); if (!$form_state->get('uid')) { // Set general error message to not leak privacy information. $this->setGeneralErrorMessage($form, $form_state); // Always register an IP-...
[ "public", "function", "validateFinal", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "flood_config", "=", "$", "this", "->", "config", "(", "'user.flood'", ")", ";", "if", "(", "!", "$", "form_state", "->", ...
Checks if user was not authenticated, or if too many logins were attempted. This validation function should always be the last one.
[ "Checks", "if", "user", "was", "not", "authenticated", "or", "if", "too", "many", "logins", "were", "attempted", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L211-L247
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserLoginForm.php
SocialUserLoginForm.setGeneralErrorMessage
protected function setGeneralErrorMessage(array &$form, FormStateInterface $form_state) { $form_state->setErrorByName('name_or_mail', $this->t(' Oops, there was an error. This may have happened for the following reasons: <br> - Invalid username/email and password combination. <br> - There ha...
php
protected function setGeneralErrorMessage(array &$form, FormStateInterface $form_state) { $form_state->setErrorByName('name_or_mail', $this->t(' Oops, there was an error. This may have happened for the following reasons: <br> - Invalid username/email and password combination. <br> - There ha...
[ "protected", "function", "setGeneralErrorMessage", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form_state", "->", "setErrorByName", "(", "'name_or_mail'", ",", "$", "this", "->", "t", "(", "'\n Oops, there w...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserLoginForm.php#L252-L260
goalgorilla/open_social
modules/social_features/social_landing_page/src/ContentTranslationDefaultsConfigOverride.php
ContentTranslationDefaultsConfigOverride.getTranslationOverrides
protected function getTranslationOverrides() { return [ 'language.content_settings.node.landing_page' => [ 'third_party_settings' => [ 'content_translation' => [ 'enabled' => TRUE, ], ], ], 'core.base_field_override.node.landing_page.title' => [ ...
php
protected function getTranslationOverrides() { return [ 'language.content_settings.node.landing_page' => [ 'third_party_settings' => [ 'content_translation' => [ 'enabled' => TRUE, ], ], ], 'core.base_field_override.node.landing_page.title' => [ ...
[ "protected", "function", "getTranslationOverrides", "(", ")", "{", "return", "[", "'language.content_settings.node.landing_page'", "=>", "[", "'third_party_settings'", "=>", "[", "'content_translation'", "=>", "[", "'enabled'", "=>", "TRUE", ",", "]", ",", "]", ",", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/ContentTranslationDefaultsConfigOverride.php#L33-L94
goalgorilla/open_social
modules/custom/social_auth_facebook/src/Plugin/Network/FacebookAuth.php
FacebookAuth.initSdk
public function initSdk() { $class_name = '\Facebook\Facebook'; if (!class_exists($class_name)) { throw new SocialApiException(sprintf('The PHP SDK for Facebook could not be found. Class: %s.', $class_name)); } if (!$this->validateConfig($this->settings)) { return FALSE; } $settin...
php
public function initSdk() { $class_name = '\Facebook\Facebook'; if (!class_exists($class_name)) { throw new SocialApiException(sprintf('The PHP SDK for Facebook could not be found. Class: %s.', $class_name)); } if (!$this->validateConfig($this->settings)) { return FALSE; } $settin...
[ "public", "function", "initSdk", "(", ")", "{", "$", "class_name", "=", "'\\Facebook\\Facebook'", ";", "if", "(", "!", "class_exists", "(", "$", "class_name", ")", ")", "{", "throw", "new", "SocialApiException", "(", "sprintf", "(", "'The PHP SDK for Facebook co...
Returns an instance of sdk. @return mixed Returns a new Facebook 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_facebook/src/Plugin/Network/FacebookAuth.php#L65-L84
goalgorilla/open_social
modules/custom/social_auth_facebook/src/Plugin/Network/FacebookAuth.php
FacebookAuth.validateConfig
protected function validateConfig(FacebookAuthSettings $settings) { $app_id = $settings->getAppId(); $app_secret = $settings->getAppSecret(); $graph_version = $settings->getGraphVersion(); if (!$app_id || !$app_secret || !$graph_version) { $this->loggerFactory ->get('social_auth_facebook'...
php
protected function validateConfig(FacebookAuthSettings $settings) { $app_id = $settings->getAppId(); $app_secret = $settings->getAppSecret(); $graph_version = $settings->getGraphVersion(); if (!$app_id || !$app_secret || !$graph_version) { $this->loggerFactory ->get('social_auth_facebook'...
[ "protected", "function", "validateConfig", "(", "FacebookAuthSettings", "$", "settings", ")", "{", "$", "app_id", "=", "$", "settings", "->", "getAppId", "(", ")", ";", "$", "app_secret", "=", "$", "settings", "->", "getAppSecret", "(", ")", ";", "$", "gra...
Checks that module is configured. @param \Drupal\social_auth_facebook\Settings\FacebookAuthSettings $settings The Facebook 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_facebook/src/Plugin/Network/FacebookAuth.php#L105-L119
goalgorilla/open_social
modules/custom/social_file_private/src/SocialFilePrivateTextEditorConfigOverride.php
SocialFilePrivateTextEditorConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; if (PrivateStream::basePath()) { $config_names = $this->getTextEditorsToProtect(); foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service('config.factory')->getEditable($con...
php
public function loadOverrides($names) { $overrides = []; if (PrivateStream::basePath()) { $config_names = $this->getTextEditorsToProtect(); foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service('config.factory')->getEditable($con...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "if", "(", "PrivateStream", "::", "basePath", "(", ")", ")", "{", "$", "config_names", "=", "$", "this", "->", "getTextEditorsToProtect", "(", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_file_private/src/SocialFilePrivateTextEditorConfigOverride.php#L41-L56
goalgorilla/open_social
modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php
ContentReportSettingsForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->configFactory->get('social_content_report.settings'); // Allow immediate unpublishing. $form['unpublish_threshold'] = [ '#type' => 'checkbox', '#title' => $this->t('Unpublished immediately'), '#descr...
php
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->configFactory->get('social_content_report.settings'); // Allow immediate unpublishing. $form['unpublish_threshold'] = [ '#type' => 'checkbox', '#title' => $this->t('Unpublished immediately'), '#descr...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "config", "=", "$", "this", "->", "configFactory", "->", "get", "(", "'social_content_report.settings'", ")", ";", "// Allow immediate unpubl...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php#L67-L101
goalgorilla/open_social
modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php
ContentReportSettingsForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $term_ids = []; foreach ($form_state->getValue('reasons_with_text') as $term_id) { if ($term_id) { $term_ids[] = $term_id; } } $this->config('social_content_repor...
php
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $term_ids = []; foreach ($form_state->getValue('reasons_with_text') as $term_id) { if ($term_id) { $term_ids[] = $term_id; } } $this->config('social_content_repor...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "parent", "::", "submitForm", "(", "$", "form", ",", "$", "form_state", ")", ";", "$", "term_ids", "=", "[", "]", ";", "foreach", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php#L106-L122
goalgorilla/open_social
modules/custom/social_demo/src/DemoGroup.php
DemoGroup.createContent
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Group with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
php
public function createContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("Group with uuid: {$uuid} has a different uuid in content."), LogLevel::ERROR); continue; } ...
[ "public", "function", "createContent", "(", ")", "{", "$", "data", "=", "$", "this", "->", "fetchData", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "uuid", "=>", "$", "item", ")", "{", "// Must have uuid and same key value.", "if", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoGroup.php#L60-L129
goalgorilla/open_social
modules/custom/social_demo/src/DemoGroup.php
DemoGroup.getEntry
protected function getEntry(array $item) { $entry = [ 'uuid' => $item['uuid'], 'langcode' => $item['langcode'], 'type' => $item['type'], 'label' => $item['label'], 'field_group_description' => [ [ 'value' => $item['description'], 'format' => 'basic_html', ...
php
protected function getEntry(array $item) { $entry = [ 'uuid' => $item['uuid'], 'langcode' => $item['langcode'], 'type' => $item['type'], 'label' => $item['label'], 'field_group_description' => [ [ 'value' => $item['description'], 'format' => 'basic_html', ...
[ "protected", "function", "getEntry", "(", "array", "$", "item", ")", "{", "$", "entry", "=", "[", "'uuid'", "=>", "$", "item", "[", "'uuid'", "]", ",", "'langcode'", "=>", "$", "item", "[", "'langcode'", "]", ",", "'type'", "=>", "$", "item", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoGroup.php#L134-L154
goalgorilla/open_social
modules/custom/social_demo/src/DemoGroup.php
DemoGroup.createDate
protected function createDate($date_string) { // Split from delimiter. $timestamp = explode('|', $date_string); $date = strtotime($timestamp[0]); $date = date('Y-m-d', $date) . 'T' . $timestamp[1] . ':00'; return strtotime($date); }
php
protected function createDate($date_string) { // Split from delimiter. $timestamp = explode('|', $date_string); $date = strtotime($timestamp[0]); $date = date('Y-m-d', $date) . 'T' . $timestamp[1] . ':00'; return strtotime($date); }
[ "protected", "function", "createDate", "(", "$", "date_string", ")", "{", "// Split from delimiter.", "$", "timestamp", "=", "explode", "(", "'|'", ",", "$", "date_string", ")", ";", "$", "date", "=", "strtotime", "(", "$", "timestamp", "[", "0", "]", ")",...
Converts a date in the correct format. @param string $date_string The date. @return int|false Returns a timestamp on success, false otherwise.
[ "Converts", "a", "date", "in", "the", "correct", "format", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoGroup.php#L165-L173
goalgorilla/open_social
modules/custom/social_demo/src/DemoGroup.php
DemoGroup.addMembers
protected function addMembers(array $members, array $managers, GroupInterface $entity) { foreach ($members as $account_uuid) { $account = $this->userStorage->loadByProperties([ 'uuid' => $account_uuid, ]); if (($account = current($account)) && !$entity->getMember($account)) { $val...
php
protected function addMembers(array $members, array $managers, GroupInterface $entity) { foreach ($members as $account_uuid) { $account = $this->userStorage->loadByProperties([ 'uuid' => $account_uuid, ]); if (($account = current($account)) && !$entity->getMember($account)) { $val...
[ "protected", "function", "addMembers", "(", "array", "$", "members", ",", "array", "$", "managers", ",", "GroupInterface", "$", "entity", ")", "{", "foreach", "(", "$", "members", "as", "$", "account_uuid", ")", "{", "$", "account", "=", "$", "this", "->...
Adds members to a group. @param array $members The array of members. @param array $managers A list of group managers. @param \Drupal\group\Entity\GroupInterface $entity The GroupInterface entity.
[ "Adds", "members", "to", "a", "group", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoGroup.php#L185-L200
goalgorilla/open_social
modules/custom/social_demo/src/DemoGroup.php
DemoGroup.prepareFiles
protected function prepareFiles($files) { $values = []; foreach ($files as $file_uuid) { $file = $this->fileStorage->loadByProperties([ 'uuid' => $file_uuid, ]); if ($file) { $values[] = [ 'target_id' => current($file)->id(), ]; } } return $va...
php
protected function prepareFiles($files) { $values = []; foreach ($files as $file_uuid) { $file = $this->fileStorage->loadByProperties([ 'uuid' => $file_uuid, ]); if ($file) { $values[] = [ 'target_id' => current($file)->id(), ]; } } return $va...
[ "protected", "function", "prepareFiles", "(", "$", "files", ")", "{", "$", "values", "=", "[", "]", ";", "foreach", "(", "$", "files", "as", "$", "file_uuid", ")", "{", "$", "file", "=", "$", "this", "->", "fileStorage", "->", "loadByProperties", "(", ...
Prepares an array with list of files to set as field value. @param string $files The uuid for the file. @return array Returns an array.
[ "Prepares", "an", "array", "with", "list", "of", "files", "to", "set", "as", "field", "value", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoGroup.php#L211-L227
goalgorilla/open_social
modules/social_features/social_user/src/Routing/RouteSubscriber.php
RouteSubscriber.alterRoutes
protected function alterRoutes(RouteCollection $collection) { // Set route for the login to point to the SocialUserLoginForm. if ($route = $collection->get('user.login')) { $route->setDefaults([ '_form' => '\Drupal\social_user\Form\SocialUserLoginForm', '_title' => t('Log in')->render(), ...
php
protected function alterRoutes(RouteCollection $collection) { // Set route for the login to point to the SocialUserLoginForm. if ($route = $collection->get('user.login')) { $route->setDefaults([ '_form' => '\Drupal\social_user\Form\SocialUserLoginForm', '_title' => t('Log in')->render(), ...
[ "protected", "function", "alterRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "// Set route for the login to point to the SocialUserLoginForm.", "if", "(", "$", "route", "=", "$", "collection", "->", "get", "(", "'user.login'", ")", ")", "{", "$", "ro...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Routing/RouteSubscriber.php#L19-L48
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/FormElement.php
FormElement.preprocessElement
public function preprocessElement(Element $element, Variables $variables) { // Check if form element is part of // email_notifications and add class to label. if (in_array('email_notifications', $element['#parents'])) { $variables['label']['#attributes']['class'][] = 'control-label--wide'; } ...
php
public function preprocessElement(Element $element, Variables $variables) { // Check if form element is part of // email_notifications and add class to label. if (in_array('email_notifications', $element['#parents'])) { $variables['label']['#attributes']['class'][] = 'control-label--wide'; } ...
[ "public", "function", "preprocessElement", "(", "Element", "$", "element", ",", "Variables", "$", "variables", ")", "{", "// Check if form element is part of", "// email_notifications and add class to label.", "if", "(", "in_array", "(", "'email_notifications'", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/FormElement.php#L21-L41
goalgorilla/open_social
modules/custom/activity_basics/src/Plugin/ActivityContext/ProfileActivityContext.php
ProfileActivityContext.getRecipients
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = ActivityFactory::getActivityRelatedEntity($data); if ($refer...
php
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = ActivityFactory::getActivityRelatedEntity($data); if ($refer...
[ "public", "function", "getRecipients", "(", "array", "$", "data", ",", "$", "last_uid", ",", "$", "limit", ")", "{", "$", "recipients", "=", "[", "]", ";", "// We only know the context if there is a related object.", "if", "(", "isset", "(", "$", "data", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_basics/src/Plugin/ActivityContext/ProfileActivityContext.php#L22-L35
goalgorilla/open_social
modules/custom/activity_basics/src/Plugin/ActivityContext/ProfileActivityContext.php
ProfileActivityContext.isValidEntity
public function isValidEntity($entity) { // Special cases for comments. if ($entity->getEntityTypeId() === 'comment') { // Returns the entity to which the comment is attached. $entity = $entity->getCommentedEntity(); } if (!isset($entity)) { return FALSE; } // Check if it's p...
php
public function isValidEntity($entity) { // Special cases for comments. if ($entity->getEntityTypeId() === 'comment') { // Returns the entity to which the comment is attached. $entity = $entity->getCommentedEntity(); } if (!isset($entity)) { return FALSE; } // Check if it's p...
[ "public", "function", "isValidEntity", "(", "$", "entity", ")", "{", "// Special cases for comments.", "if", "(", "$", "entity", "->", "getEntityTypeId", "(", ")", "===", "'comment'", ")", "{", "// Returns the entity to which the comment is attached.", "$", "entity", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_basics/src/Plugin/ActivityContext/ProfileActivityContext.php#L40-L64
goalgorilla/open_social
themes/socialbase/src/Plugin/Process/ManagedFile.php
ManagedFile.processElement
public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) { $ajax_wrapper_id = $element->upload_button->getProperty('ajax')['wrapper']; if ($prefix = $element->getProperty('prefix')) { $prefix = preg_replace('/<div id="' . $ajax_wrapper_id . '">/', '<di...
php
public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) { $ajax_wrapper_id = $element->upload_button->getProperty('ajax')['wrapper']; if ($prefix = $element->getProperty('prefix')) { $prefix = preg_replace('/<div id="' . $ajax_wrapper_id . '">/', '<di...
[ "public", "static", "function", "processElement", "(", "Element", "$", "element", ",", "FormStateInterface", "$", "form_state", ",", "array", "&", "$", "complete_form", ")", "{", "$", "ajax_wrapper_id", "=", "$", "element", "->", "upload_button", "->", "getPrope...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Process/ManagedFile.php#L21-L27
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/Activity.php
Activity.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Check if the view mode is one of the notification view modes. if (in_array($variables['content']['field_activity_output_text']['#view_mode'], [ 'notification', 'notification_arch...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Check if the view mode is one of the notification view modes. if (in_array($variables['content']['field_activity_output_text']['#view_mode'], [ 'notification', 'notification_arch...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// Check if the view mode ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Activity.php#L19-L38
goalgorilla/open_social
modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php
EntityAccessByFieldPermissions.permissions
public function permissions() { $permissions = []; $contentTypes = $this->getContentTypes(); foreach ($contentTypes as $bundle) { $entity_type = 'node'; $fields = $this->getEntityAccessFields($entity_type, $bundle); /** @var \Drupal\field\Entity\FieldConfig $field */ foreach ($fiel...
php
public function permissions() { $permissions = []; $contentTypes = $this->getContentTypes(); foreach ($contentTypes as $bundle) { $entity_type = 'node'; $fields = $this->getEntityAccessFields($entity_type, $bundle); /** @var \Drupal\field\Entity\FieldConfig $field */ foreach ($fiel...
[ "public", "function", "permissions", "(", ")", "{", "$", "permissions", "=", "[", "]", ";", "$", "contentTypes", "=", "$", "this", "->", "getContentTypes", "(", ")", ";", "foreach", "(", "$", "contentTypes", "as", "$", "bundle", ")", "{", "$", "entity_...
Return all the permissions generated by this user.
[ "Return", "all", "the", "permissions", "generated", "by", "this", "user", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php#L58-L87
goalgorilla/open_social
modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php
EntityAccessByFieldPermissions.getRealmWithPermission
public function getRealmWithPermission() { $realms = []; $contentTypes = $this->getContentTypes(); foreach ($contentTypes as $bundle) { $entity_type = 'node'; $fields = $this->getEntityAccessFields($entity_type, $bundle); /** @var \Drupal\field\Entity\FieldConfig $field */ foreac...
php
public function getRealmWithPermission() { $realms = []; $contentTypes = $this->getContentTypes(); foreach ($contentTypes as $bundle) { $entity_type = 'node'; $fields = $this->getEntityAccessFields($entity_type, $bundle); /** @var \Drupal\field\Entity\FieldConfig $field */ foreac...
[ "public", "function", "getRealmWithPermission", "(", ")", "{", "$", "realms", "=", "[", "]", ";", "$", "contentTypes", "=", "$", "this", "->", "getContentTypes", "(", ")", ";", "foreach", "(", "$", "contentTypes", "as", "$", "bundle", ")", "{", "$", "e...
Get the realms array with permissions as value.
[ "Get", "the", "realms", "array", "with", "permissions", "as", "value", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php#L92-L123
goalgorilla/open_social
modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php
EntityAccessByFieldPermissions.getRealmForFieldValue
public function getRealmForFieldValue($op, $entity_type, $bundle_id, $field_name, $field_value) { $realm = $op . '_' . $entity_type . '_' . $bundle_id . '_' . $field_name . '_' . $field_value; return $realm; }
php
public function getRealmForFieldValue($op, $entity_type, $bundle_id, $field_name, $field_value) { $realm = $op . '_' . $entity_type . '_' . $bundle_id . '_' . $field_name . '_' . $field_value; return $realm; }
[ "public", "function", "getRealmForFieldValue", "(", "$", "op", ",", "$", "entity_type", ",", "$", "bundle_id", ",", "$", "field_name", ",", "$", "field_value", ")", "{", "$", "realm", "=", "$", "op", ".", "'_'", ".", "$", "entity_type", ".", "'_'", "."...
Returns a realm for a field value in order to create access. @return string The string with the realm created.
[ "Returns", "a", "realm", "for", "a", "field", "value", "in", "order", "to", "create", "access", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php#L131-L134
goalgorilla/open_social
modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php
EntityAccessByFieldPermissions.getEntityAccessFields
public function getEntityAccessFields($entity, $bundle) { $fields = []; $field_definitions = $this->entityManager->getFieldDefinitions($entity, $bundle->id()); foreach ($field_definitions as $field_name => $field_definition) { if (!empty($field_definition->getTargetBundle())) { if ($field_defi...
php
public function getEntityAccessFields($entity, $bundle) { $fields = []; $field_definitions = $this->entityManager->getFieldDefinitions($entity, $bundle->id()); foreach ($field_definitions as $field_name => $field_definition) { if (!empty($field_definition->getTargetBundle())) { if ($field_defi...
[ "public", "function", "getEntityAccessFields", "(", "$", "entity", ",", "$", "bundle", ")", "{", "$", "fields", "=", "[", "]", ";", "$", "field_definitions", "=", "$", "this", "->", "entityManager", "->", "getFieldDefinitions", "(", "$", "entity", ",", "$"...
Get all fields of type entity_access_field. @return array Returns all the fields with the entity type entity_acces_field.
[ "Get", "all", "fields", "of", "type", "entity_access_field", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/entity_access_by_field/src/EntityAccessByFieldPermissions.php#L153-L164
goalgorilla/open_social
modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php
EntityVisibilityForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { $form_state->cleanValues(); $this ->config('entity_access_by_field.settings') ->setData($form_state->getValues()) ->save(); parent::submitForm($form, $form_state); }
php
public function submitForm(array &$form, FormStateInterface $form_state) { $form_state->cleanValues(); $this ->config('entity_access_by_field.settings') ->setData($form_state->getValues()) ->save(); parent::submitForm($form, $form_state); }
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form_state", "->", "cleanValues", "(", ")", ";", "$", "this", "->", "config", "(", "'entity_access_by_field.settings'", ")", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php#L61-L69
goalgorilla/open_social
modules/social_features/social_mentions/src/Plugin/ActivityEntityCondition/MentionCommentActivityEntityCondition.php
MentionCommentActivityEntityCondition.isValidEntityCondition
public function isValidEntityCondition($entity) { if ($entity->getEntityTypeId() === 'mentions') { if (isset($entity->entity_type) && $entity->entity_type->value == 'comment') { return TRUE; } } return FALSE; }
php
public function isValidEntityCondition($entity) { if ($entity->getEntityTypeId() === 'mentions') { if (isset($entity->entity_type) && $entity->entity_type->value == 'comment') { return TRUE; } } return FALSE; }
[ "public", "function", "isValidEntityCondition", "(", "$", "entity", ")", "{", "if", "(", "$", "entity", "->", "getEntityTypeId", "(", ")", "===", "'mentions'", ")", "{", "if", "(", "isset", "(", "$", "entity", "->", "entity_type", ")", "&&", "$", "entity...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_mentions/src/Plugin/ActivityEntityCondition/MentionCommentActivityEntityCondition.php#L21-L28
goalgorilla/open_social
modules/custom/social_file_private/src/SocialFilePrivateFieldsConfigOverride.php
SocialFilePrivateFieldsConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; if (PrivateStream::basePath()) { $config_names = $this->getFileImageFieldsToProtect(); foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service('config.factory')->getEditable(...
php
public function loadOverrides($names) { $overrides = []; if (PrivateStream::basePath()) { $config_names = $this->getFileImageFieldsToProtect(); foreach ($config_names as $config_name) { if (in_array($config_name, $names)) { $config = \Drupal::service('config.factory')->getEditable(...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "if", "(", "PrivateStream", "::", "basePath", "(", ")", ")", "{", "$", "config_names", "=", "$", "this", "->", "getFileImageFieldsToProtect", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_file_private/src/SocialFilePrivateFieldsConfigOverride.php#L53-L68
goalgorilla/open_social
modules/custom/activity_creator/src/Plugin/ActivityEntityConditionManager.php
ActivityEntityConditionManager.getOptionsList
public function getOptionsList(array $entities = []) { $options = []; if (!empty($entities)) { foreach ($entities as $entity) { $entity = explode('-', $entity); $entity_type = $entity[0]; $bundle = $entity[1]; // Get all entity condition plugin definitions. foreach...
php
public function getOptionsList(array $entities = []) { $options = []; if (!empty($entities)) { foreach ($entities as $entity) { $entity = explode('-', $entity); $entity_type = $entity[0]; $bundle = $entity[1]; // Get all entity condition plugin definitions. foreach...
[ "public", "function", "getOptionsList", "(", "array", "$", "entities", "=", "[", "]", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "entities", ")", ")", "{", "foreach", "(", "$", "entities", "as", "$", "entity", ...
Retrieves an options list of available trackers. @param array $entities Value of activity_bundle_entities array with "entity.bundle" values. @return string[] An associative array mapping the IDs of all available tracker plugins to their labels.
[ "Retrieves", "an", "options", "list", "of", "available", "trackers", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Plugin/ActivityEntityConditionManager.php#L43-L75
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/SocialEventManagersSendEmail.php
SocialEventManagersSendEmail.execute
public function execute($entity = NULL) { $accounts = $entity->field_account->referencedEntities(); $account = reset($accounts); parent::execute($account); return $this->t('Send mail'); }
php
public function execute($entity = NULL) { $accounts = $entity->field_account->referencedEntities(); $account = reset($accounts); parent::execute($account); return $this->t('Send mail'); }
[ "public", "function", "execute", "(", "$", "entity", "=", "NULL", ")", "{", "$", "accounts", "=", "$", "entity", "->", "field_account", "->", "referencedEntities", "(", ")", ";", "$", "account", "=", "reset", "(", "$", "accounts", ")", ";", "parent", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_managers/src/Plugin/Action/SocialEventManagersSendEmail.php#L30-L36
goalgorilla/open_social
modules/social_features/social_private_message/src/Routing/RouteSubscriber.php
RouteSubscriber.alterRoutes
protected function alterRoutes(RouteCollection $collection) { // Route the old private message page to the inbox. if ($route = $collection->get('private_message.private_message_page')) { // Deny access to this route. $route->setRequirement('_access', 'FALSE'); } // Route the private message ...
php
protected function alterRoutes(RouteCollection $collection) { // Route the old private message page to the inbox. if ($route = $collection->get('private_message.private_message_page')) { // Deny access to this route. $route->setRequirement('_access', 'FALSE'); } // Route the private message ...
[ "protected", "function", "alterRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "// Route the old private message page to the inbox.", "if", "(", "$", "route", "=", "$", "collection", "->", "get", "(", "'private_message.private_message_page'", ")", ")", "{"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Routing/RouteSubscriber.php#L19-L30
goalgorilla/open_social
modules/social_features/social_topic/src/Controller/SocialTopicController.php
SocialTopicController.myTopicAccess
public function myTopicAccess(AccountInterface $account) { // Fetch user from url. $user = $this->requestStack->getCurrentRequest()->get('user'); // If we don't have a user in the request, assume it's my own profile. if (is_null($user)) { // Usecase is the user menu, which is generated on all LU ...
php
public function myTopicAccess(AccountInterface $account) { // Fetch user from url. $user = $this->requestStack->getCurrentRequest()->get('user'); // If we don't have a user in the request, assume it's my own profile. if (is_null($user)) { // Usecase is the user menu, which is generated on all LU ...
[ "public", "function", "myTopicAccess", "(", "AccountInterface", "$", "account", ")", "{", "// Fetch user from url.", "$", "user", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "->", "get", "(", "'user'", ")", ";", "// If we don't h...
Function that checks access on the my topic pages. @param \Drupal\Core\Session\AccountInterface $account The account we need to check access for. @return \Drupal\Core\Access\AccessResult If access is allowed.
[ "Function", "that", "checks", "access", "on", "the", "my", "topic", "pages", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_topic/src/Controller/SocialTopicController.php#L105-L129
goalgorilla/open_social
modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/OpenSocialVersion.php
OpenSocialVersion.getValue
public function getValue() { $version = 0; $profile = \Drupal::installProfile(); if ($profile === 'social') { $info = system_get_info('module', $profile); $version = $info['version']; } return [ 'version' => $version, ]; }
php
public function getValue() { $version = 0; $profile = \Drupal::installProfile(); if ($profile === 'social') { $info = system_get_info('module', $profile); $version = $info['version']; } return [ 'version' => $version, ]; }
[ "public", "function", "getValue", "(", ")", "{", "$", "version", "=", "0", ";", "$", "profile", "=", "\\", "Drupal", "::", "installProfile", "(", ")", ";", "if", "(", "$", "profile", "===", "'social'", ")", "{", "$", "info", "=", "system_get_info", "...
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/OpenSocialVersion.php#L25-L35
goalgorilla/open_social
modules/custom/social_language/src/SocialLanguageModalRenderer.php
SocialLanguageModalRenderer.renderResponse
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) { $sub_request = $request->request->all(); $sub_request['dialogOptions']['closeText'] = $this->t('Close'); $request = new Request( $request->query->all(), $sub_request, $request->attrib...
php
public function renderResponse(array $main_content, Request $request, RouteMatchInterface $route_match) { $sub_request = $request->request->all(); $sub_request['dialogOptions']['closeText'] = $this->t('Close'); $request = new Request( $request->query->all(), $sub_request, $request->attrib...
[ "public", "function", "renderResponse", "(", "array", "$", "main_content", ",", "Request", "$", "request", ",", "RouteMatchInterface", "$", "route_match", ")", "{", "$", "sub_request", "=", "$", "request", "->", "request", "->", "all", "(", ")", ";", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_language/src/SocialLanguageModalRenderer.php#L20-L35
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/UserExportPlugin/EnrolmentUserDisplayName.php
EnrolmentUserDisplayName.getValue
public function getValue(UserInterface $entity) { if ($entity->isAnonymous()) { $value = $this->socialEventAnEnrollManager->getGuestName($this->configuration['entity'], FALSE); return $value ?: $this->t('Guest'); } return parent::getValue($entity); }
php
public function getValue(UserInterface $entity) { if ($entity->isAnonymous()) { $value = $this->socialEventAnEnrollManager->getGuestName($this->configuration['entity'], FALSE); return $value ?: $this->t('Guest'); } return parent::getValue($entity); }
[ "public", "function", "getValue", "(", "UserInterface", "$", "entity", ")", "{", "if", "(", "$", "entity", "->", "isAnonymous", "(", ")", ")", "{", "$", "value", "=", "$", "this", "->", "socialEventAnEnrollManager", "->", "getGuestName", "(", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/UserExportPlugin/EnrolmentUserDisplayName.php#L81-L89
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Post.php
Post.getEntry
public function getEntry(array $item) { $recipient_id = NULL; $group_id = NULL; $file_id = NULL; $entry = parent::getEntry($item); $created = $this->createDate($item['created']); if (!empty($item['recipient']) && ($recipient = $this->loadByUuid('user', $item['recipient']))) { $recipient_i...
php
public function getEntry(array $item) { $recipient_id = NULL; $group_id = NULL; $file_id = NULL; $entry = parent::getEntry($item); $created = $this->createDate($item['created']); if (!empty($item['recipient']) && ($recipient = $this->loadByUuid('user', $item['recipient']))) { $recipient_i...
[ "public", "function", "getEntry", "(", "array", "$", "item", ")", "{", "$", "recipient_id", "=", "NULL", ";", "$", "group_id", "=", "NULL", ";", "$", "file_id", "=", "NULL", ";", "$", "entry", "=", "parent", "::", "getEntry", "(", "$", "item", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Post.php#L22-L57
goalgorilla/open_social
modules/social_features/social_content_report/src/Access/FlagAccessCheck.php
FlagAccessCheck.access
public function access(AccountInterface $account, FlagInterface $flag, $entity_id) { if (in_array($flag->id(), $this->socialContentReport->getReportFlagTypes())) { // Make sure user is allowed to use the flag. if (!$account->hasPermission('flag ' . $flag->id())) { return AccessResult::forbidden(...
php
public function access(AccountInterface $account, FlagInterface $flag, $entity_id) { if (in_array($flag->id(), $this->socialContentReport->getReportFlagTypes())) { // Make sure user is allowed to use the flag. if (!$account->hasPermission('flag ' . $flag->id())) { return AccessResult::forbidden(...
[ "public", "function", "access", "(", "AccountInterface", "$", "account", ",", "FlagInterface", "$", "flag", ",", "$", "entity_id", ")", "{", "if", "(", "in_array", "(", "$", "flag", "->", "id", "(", ")", ",", "$", "this", "->", "socialContentReport", "->...
Checks if user is allowed to flag. @param \Drupal\Core\Session\AccountInterface $account Run access checks for this account. @param \Drupal\flag\FlagInterface $flag The flag type. @param int $entity_id The entity ID which is being reported. @return \Drupal\Core\Access\AccessResult Allowed if user may use the flag and...
[ "Checks", "if", "user", "is", "allowed", "to", "flag", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_content_report/src/Access/FlagAccessCheck.php#L72-L90
goalgorilla/open_social
modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php
SocialGroupAdminPeopleConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_name = 'views.view.user_admin_people'; // Add AddMembersToGroup to VBO Admin people. if (in_array($config_name, $names, TRUE)) { $overrides[$config_name] = [ 'display' => [ 'default' => [ 'display_opti...
php
public function loadOverrides($names) { $overrides = []; $config_name = 'views.view.user_admin_people'; // Add AddMembersToGroup to VBO Admin people. if (in_array($config_name, $names, TRUE)) { $overrides[$config_name] = [ 'display' => [ 'default' => [ 'display_opti...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_name", "=", "'views.view.user_admin_people'", ";", "// Add AddMembersToGroup to VBO Admin people.", "if", "(", "in_array", "(", "$", "config_name",...
Load overrides.
[ "Load", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SocialGroupAdminPeopleConfigOverride.php#L37-L80
goalgorilla/open_social
modules/social_features/social_comment/src/SocialCommentViewBuilder.php
SocialCommentViewBuilder.alterBuild
protected function alterBuild(array &$build, EntityInterface $comment, EntityViewDisplayInterface $display, $view_mode) { parent::alterBuild($build, $comment, $display, $view_mode); if (empty($comment->in_preview)) { $prefix = ''; // Add indentation div or close open divs as needed. if ($buil...
php
protected function alterBuild(array &$build, EntityInterface $comment, EntityViewDisplayInterface $display, $view_mode) { parent::alterBuild($build, $comment, $display, $view_mode); if (empty($comment->in_preview)) { $prefix = ''; // Add indentation div or close open divs as needed. if ($buil...
[ "protected", "function", "alterBuild", "(", "array", "&", "$", "build", ",", "EntityInterface", "$", "comment", ",", "EntityViewDisplayInterface", "$", "display", ",", "$", "view_mode", ")", "{", "parent", "::", "alterBuild", "(", "$", "build", ",", "$", "co...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/SocialCommentViewBuilder.php#L17-L62
goalgorilla/open_social
modules/custom/activity_creator/src/Entity/Activity.php
Activity.getRelatedEntityUrl
public function getRelatedEntityUrl() { $link = ""; $related_object = $this->get('field_activity_entity')->getValue(); if (!empty($related_object)) { $target_type = $related_object['0']['target_type']; $target_id = $related_object['0']['target_id']; // Make an exception for Votes. ...
php
public function getRelatedEntityUrl() { $link = ""; $related_object = $this->get('field_activity_entity')->getValue(); if (!empty($related_object)) { $target_type = $related_object['0']['target_type']; $target_id = $related_object['0']['target_id']; // Make an exception for Votes. ...
[ "public", "function", "getRelatedEntityUrl", "(", ")", "{", "$", "link", "=", "\"\"", ";", "$", "related_object", "=", "$", "this", "->", "get", "(", "'field_activity_entity'", ")", "->", "getValue", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "r...
Get related entity url. @return \Drupal\Core\Url|string Returns empty string or URL object of related entity canonical url.
[ "Get", "related", "entity", "url", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Entity/Activity.php#L202-L253
goalgorilla/open_social
modules/custom/activity_creator/src/Entity/Activity.php
Activity.getDestinations
public function getDestinations() { $values = []; $field_activity_destinations = $this->field_activity_destinations; if (isset($field_activity_destinations)) { $destinations = $field_activity_destinations->getValue(); foreach ($destinations as $destination) { $values[] = $destination['va...
php
public function getDestinations() { $values = []; $field_activity_destinations = $this->field_activity_destinations; if (isset($field_activity_destinations)) { $destinations = $field_activity_destinations->getValue(); foreach ($destinations as $destination) { $values[] = $destination['va...
[ "public", "function", "getDestinations", "(", ")", "{", "$", "values", "=", "[", "]", ";", "$", "field_activity_destinations", "=", "$", "this", "->", "field_activity_destinations", ";", "if", "(", "isset", "(", "$", "field_activity_destinations", ")", ")", "{...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Entity/Activity.php#L258-L268
goalgorilla/open_social
modules/custom/activity_creator/src/Entity/Activity.php
Activity.getRecipient
public function getRecipient() { $value = NULL; $field_activity_recipient_user = $this->field_activity_recipient_user; if (isset($field_activity_recipient_user)) { $recipient_user = $field_activity_recipient_user->getValue(); if (!empty($recipient_user)) { $recipient_user['0']['target_t...
php
public function getRecipient() { $value = NULL; $field_activity_recipient_user = $this->field_activity_recipient_user; if (isset($field_activity_recipient_user)) { $recipient_user = $field_activity_recipient_user->getValue(); if (!empty($recipient_user)) { $recipient_user['0']['target_t...
[ "public", "function", "getRecipient", "(", ")", "{", "$", "value", "=", "NULL", ";", "$", "field_activity_recipient_user", "=", "$", "this", "->", "field_activity_recipient_user", ";", "if", "(", "isset", "(", "$", "field_activity_recipient_user", ")", ")", "{",...
Get recipient. Assume that activity can't have recipient group and user at the same time. @todo: Split it to two separate functions.
[ "Get", "recipient", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Entity/Activity.php#L277-L299
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/ImageWidget.php
ImageWidget.preprocessElement
public function preprocessElement(Element $element, Variables $variables) { if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'edit-field-post-image-0-upload') { $variables['in_post'] = TRUE; } if (isset($variables['data']['remove_button'])) { $variables['data']['remo...
php
public function preprocessElement(Element $element, Variables $variables) { if (isset($variables['element']['#id']) && $variables['element']['#id'] == 'edit-field-post-image-0-upload') { $variables['in_post'] = TRUE; } if (isset($variables['data']['remove_button'])) { $variables['data']['remo...
[ "public", "function", "preprocessElement", "(", "Element", "$", "element", ",", "Variables", "$", "variables", ")", "{", "if", "(", "isset", "(", "$", "variables", "[", "'element'", "]", "[", "'#id'", "]", ")", "&&", "$", "variables", "[", "'element'", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/ImageWidget.php#L25-L36
goalgorilla/open_social
modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsOverride.php
SocialProfileFieldsOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Add field_group and field_comment_files. $config_name = 'core.entity_form_display.profile.profile.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEdi...
php
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Add field_group and field_comment_files. $config_name = 'core.entity_form_display.profile.profile.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEdi...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_factory", "=", "\\", "Drupal", "::", "service", "(", "'config.factory'", ")", ";", "// Add field_group and field_comment_files.", "$", "config_...
Returns config overrides.
[ "Returns", "config", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsOverride.php#L21-L100
goalgorilla/open_social
modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerLogger.php
ActivityWorkerLogger.processItem
public function processItem($data) { // Get 100 Recipients at a time. $limit = 0; // TODO: Move all this logic to a service. // TODO: Change this to use dependency injection. $context_plugin_manager = \Drupal::service('plugin.manager.activity_context.processor'); /* @var $plugin \Drupal\activi...
php
public function processItem($data) { // Get 100 Recipients at a time. $limit = 0; // TODO: Move all this logic to a service. // TODO: Change this to use dependency injection. $context_plugin_manager = \Drupal::service('plugin.manager.activity_context.processor'); /* @var $plugin \Drupal\activi...
[ "public", "function", "processItem", "(", "$", "data", ")", "{", "// Get 100 Recipients at a time.", "$", "limit", "=", "0", ";", "// TODO: Move all this logic to a service.", "// TODO: Change this to use dependency injection.", "$", "context_plugin_manager", "=", "\\", "Drup...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerLogger.php#L37-L90
goalgorilla/open_social
modules/social_features/social_private_message/src/Plugin/ActivityContext/PrivateMessageActivityContext.php
PrivateMessageActivityContext.getRecipients
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $related_object = $data['related_object'][0]; if ($related_object['target_type'] =...
php
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $related_object = $data['related_object'][0]; if ($related_object['target_type'] =...
[ "public", "function", "getRecipients", "(", "array", "$", "data", ",", "$", "last_uid", ",", "$", "limit", ")", "{", "$", "recipients", "=", "[", "]", ";", "// We only know the context if there is a related object.", "if", "(", "isset", "(", "$", "data", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Plugin/ActivityContext/PrivateMessageActivityContext.php#L22-L61
goalgorilla/open_social
modules/social_features/social_event/src/EventEnrollmentAccessControlHandler.php
EventEnrollmentAccessControlHandler.checkAccess
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_event\EventEnrollmentInterface $entity */ switch ($operation) { case 'view': if (!$entity->isPublished()) { return AccessResult::allowedIfHasPermission($account, 'view...
php
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_event\EventEnrollmentInterface $entity */ switch ($operation) { case 'view': if (!$entity->isPublished()) { return AccessResult::allowedIfHasPermission($account, 'view...
[ "protected", "function", "checkAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "/** @var \\Drupal\\social_event\\EventEnrollmentInterface $entity */", "switch", "(", "$", "operation", ")", "{", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/EventEnrollmentAccessControlHandler.php#L20-L38
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php
UserExportPluginBase.getProfile
public function getProfile(UserInterface $entity) { $user_profile = NULL; /** @var \Drupal\profile\ProfileStorageInterface $storage */ try { $storage = $this->entityTypeManager->getStorage('profile'); if (!empty($storage)) { $user_profile = $storage->loadByUser($entity, 'profile', TRUE)...
php
public function getProfile(UserInterface $entity) { $user_profile = NULL; /** @var \Drupal\profile\ProfileStorageInterface $storage */ try { $storage = $this->entityTypeManager->getStorage('profile'); if (!empty($storage)) { $user_profile = $storage->loadByUser($entity, 'profile', TRUE)...
[ "public", "function", "getProfile", "(", "UserInterface", "$", "entity", ")", "{", "$", "user_profile", "=", "NULL", ";", "/** @var \\Drupal\\profile\\ProfileStorageInterface $storage */", "try", "{", "$", "storage", "=", "$", "this", "->", "entityTypeManager", "->", ...
Get the Profile entity. @param \Drupal\user\UserInterface $entity The user entity to get the profile from. @return \Drupal\profile\Entity\ProfileInterface|null Returns the Profile or NULL if profile does not exist.
[ "Get", "the", "Profile", "entity", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php#L126-L144
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php
UserExportPluginBase.profileGetFieldValue
public function profileGetFieldValue($field_name, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } try { $value = $user_profile->get($field_name)->value; } catch (\Exception $e) { $value = ''; } return $value; }
php
public function profileGetFieldValue($field_name, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } try { $value = $user_profile->get($field_name)->value; } catch (\Exception $e) { $value = ''; } return $value; }
[ "public", "function", "profileGetFieldValue", "(", "$", "field_name", ",", "ProfileInterface", "$", "user_profile", "=", "NULL", ")", "{", "if", "(", "$", "user_profile", "===", "NULL", ")", "{", "return", "''", ";", "}", "try", "{", "$", "value", "=", "...
Returns the value of a field for a given profile. @param string $field_name The field name to get the value for. @param \Drupal\profile\Entity\ProfileInterface $user_profile The profile to get the data for. @return string Returns value of the field.
[ "Returns", "the", "value", "of", "a", "field", "for", "a", "given", "profile", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php#L157-L169
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php
UserExportPluginBase.profileGetAddressFieldValue
public function profileGetAddressFieldValue($field_name, $address_element, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } $value = ''; try { $address = $user_profile->get($field_name)->getValue(); if (isset($address['0'][$address_element])) { ...
php
public function profileGetAddressFieldValue($field_name, $address_element, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } $value = ''; try { $address = $user_profile->get($field_name)->getValue(); if (isset($address['0'][$address_element])) { ...
[ "public", "function", "profileGetAddressFieldValue", "(", "$", "field_name", ",", "$", "address_element", ",", "ProfileInterface", "$", "user_profile", "=", "NULL", ")", "{", "if", "(", "$", "user_profile", "===", "NULL", ")", "{", "return", "''", ";", "}", ...
Returns the value for the address field and element within address. @param string $field_name The field name to get the value for. @param string $address_element The address element to get the value for, e.g. 'country_code'. @param \Drupal\profile\Entity\ProfileInterface $user_profile The profile to get the data for. ...
[ "Returns", "the", "value", "for", "the", "address", "field", "and", "element", "within", "address", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php#L184-L200
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php
UserExportPluginBase.profileGetTaxonomyFieldValue
public function profileGetTaxonomyFieldValue($field_name, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } $names = array_map( function (TermInterface $taxonomy_term) { return $taxonomy_term->getName(); }, $user_profile->get($field_name)->r...
php
public function profileGetTaxonomyFieldValue($field_name, ProfileInterface $user_profile = NULL) { if ($user_profile === NULL) { return ''; } $names = array_map( function (TermInterface $taxonomy_term) { return $taxonomy_term->getName(); }, $user_profile->get($field_name)->r...
[ "public", "function", "profileGetTaxonomyFieldValue", "(", "$", "field_name", ",", "ProfileInterface", "$", "user_profile", "=", "NULL", ")", "{", "if", "(", "$", "user_profile", "===", "NULL", ")", "{", "return", "''", ";", "}", "$", "names", "=", "array_ma...
Returns the values of a taxonomy reference field. @param string $field_name The field name to get the value for, should be taxonomy term reference. @param \Drupal\profile\Entity\ProfileInterface $user_profile The profile to get the data for. @return string Returns comma separated string of taxonomy terms of the field...
[ "Returns", "the", "values", "of", "a", "taxonomy", "reference", "field", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php#L213-L226
goalgorilla/open_social
modules/custom/social_demo/src/DemoEntity.php
DemoEntity.createContent
public function createContent() { $data = $this->fetchData(); $entity_type_id = $this->entityStorage->getEntityTypeId(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("{$entity_type_id} with uuid: {$uuid} has a diff...
php
public function createContent() { $data = $this->fetchData(); $entity_type_id = $this->entityStorage->getEntityTypeId(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { drush_log(dt("{$entity_type_id} with uuid: {$uuid} has a diff...
[ "public", "function", "createContent", "(", ")", "{", "$", "data", "=", "$", "this", "->", "fetchData", "(", ")", ";", "$", "entity_type_id", "=", "$", "this", "->", "entityStorage", "->", "getEntityTypeId", "(", ")", ";", "foreach", "(", "$", "data", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoEntity.php#L39-L68
goalgorilla/open_social
themes/socialblue/src/Plugin/Preprocess/Html.php
Html.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); $variables['colors'] = []; foreach (color_get_palette($variables['theme']['name']) as $key => $value) { $key = str_replace('-', '_', $key); $variables['colors'][$key] = $value; ...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); $variables['colors'] = []; foreach (color_get_palette($variables['theme']['name']) as $key => $value) { $key = str_replace('-', '_', $key); $variables['colors'][$key] = $value; ...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "$", "variables", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialblue/src/Plugin/Preprocess/Html.php#L19-L30
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/Container.php
Container.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // For pages in search we would like to render containers without divs. $routename = \Drupal::request() ->get(RouteObjectInterface::ROUTE_NAME); if (strpos($routename, 'search') !== F...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // For pages in search we would like to render containers without divs. $routename = \Drupal::request() ->get(RouteObjectInterface::ROUTE_NAME); if (strpos($routename, 'search') !== F...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// For pages in search we ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Container.php#L20-L59
goalgorilla/open_social
modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php
ContentInMyGroupActivityContext.getRecipients
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = ActivityFactory::getActivityRelatedEntity($data); $owner_id =...
php
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = ActivityFactory::getActivityRelatedEntity($data); $owner_id =...
[ "public", "function", "getRecipients", "(", "array", "$", "data", ",", "$", "last_uid", ",", "$", "limit", ")", "{", "$", "recipients", "=", "[", "]", ";", "// We only know the context if there is a related object.", "if", "(", "isset", "(", "$", "data", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php#L24-L69
goalgorilla/open_social
modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php
ContentInMyGroupActivityContext.isValidEntity
public function isValidEntity($entity) { // Check if it's placed in a group (regardless off content type). if ($entity->getEntityTypeId() === 'group_content') { return TRUE; } if ($entity->getEntityTypeId() === 'post') { if (!empty($entity->get('field_recipient_group')->getValue())) { ...
php
public function isValidEntity($entity) { // Check if it's placed in a group (regardless off content type). if ($entity->getEntityTypeId() === 'group_content') { return TRUE; } if ($entity->getEntityTypeId() === 'post') { if (!empty($entity->get('field_recipient_group')->getValue())) { ...
[ "public", "function", "isValidEntity", "(", "$", "entity", ")", "{", "// Check if it's placed in a group (regardless off content type).", "if", "(", "$", "entity", "->", "getEntityTypeId", "(", ")", "===", "'group_content'", ")", "{", "return", "TRUE", ";", "}", "if...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php#L74-L85
goalgorilla/open_social
modules/social_features/social_user_export/src/SocialUserExportOverrides.php
SocialUserExportOverrides.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_name = 'views.view.user_admin_people'; if (in_array($config_name, $names)) { $overrides[$config_name] = [ 'display' => [ 'default' => [ 'display_options' => [ 'fields' => [ 'v...
php
public function loadOverrides($names) { $overrides = []; $config_name = 'views.view.user_admin_people'; if (in_array($config_name, $names)) { $overrides[$config_name] = [ 'display' => [ 'default' => [ 'display_options' => [ 'fields' => [ 'v...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_name", "=", "'views.view.user_admin_people'", ";", "if", "(", "in_array", "(", "$", "config_name", ",", "$", "names", ")", ")", "{", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/SocialUserExportOverrides.php#L17-L46
goalgorilla/open_social
modules/social_features/social_post/src/Routing/RouteSubscriber.php
RouteSubscriber.alterRoutes
public function alterRoutes(RouteCollection $collection) { /** @var \Symfony\Component\Routing\Route $route */ if ($route = $collection->get('comment.reply')) { $route->setDefaults([ '_controller' => '\Drupal\social_post\Controller\PostCommentController::getReplyForm', '_title' => t('Add n...
php
public function alterRoutes(RouteCollection $collection) { /** @var \Symfony\Component\Routing\Route $route */ if ($route = $collection->get('comment.reply')) { $route->setDefaults([ '_controller' => '\Drupal\social_post\Controller\PostCommentController::getReplyForm', '_title' => t('Add n...
[ "public", "function", "alterRoutes", "(", "RouteCollection", "$", "collection", ")", "{", "/** @var \\Symfony\\Component\\Routing\\Route $route */", "if", "(", "$", "route", "=", "$", "collection", "->", "get", "(", "'comment.reply'", ")", ")", "{", "$", "route", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Routing/RouteSubscriber.php#L16-L25
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/Html.php
Html.preprocess
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Identify the difference between nodes and node/add & node/edit. if ($variables['root_path'] == 'node') { $current_path = \Drupal::service('path.current')->getPath(); $path_pieces...
php
public function preprocess(array &$variables, $hook, array $info) { parent::preprocess($variables, $hook, $info); // Identify the difference between nodes and node/add & node/edit. if ($variables['root_path'] == 'node') { $current_path = \Drupal::service('path.current')->getPath(); $path_pieces...
[ "public", "function", "preprocess", "(", "array", "&", "$", "variables", ",", "$", "hook", ",", "array", "$", "info", ")", "{", "parent", "::", "preprocess", "(", "$", "variables", ",", "$", "hook", ",", "$", "info", ")", ";", "// Identify the difference...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Html.php#L19-L35
goalgorilla/open_social
modules/social_features/social_profile/modules/social_profile_organization_tag/src/SocialProfileOrgTagConfigOverride.php
SocialProfileOrgTagConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Override profile form display. $config_name = 'core.entity_form_display.profile.profile.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable($con...
php
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Override profile form display. $config_name = 'core.entity_form_display.profile.profile.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable($con...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_factory", "=", "\\", "Drupal", "::", "service", "(", "'config.factory'", ")", ";", "// Override profile form display.", "$", "config_name", "...
Load overrides.
[ "Load", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/modules/social_profile_organization_tag/src/SocialProfileOrgTagConfigOverride.php#L19-L70