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 | themes/socialbase/src/Plugin/Preprocess/Node.php | Node.preprocessElement | protected function preprocessElement(Element $element, Variables $variables) {
/** @var \Drupal\node\Entity\Node $node */
$node = $variables['node'];
$account = $node->getOwner();
$variables['content_type'] = $node->bundle();
// We get the group link to the node if there is one,
// will return ... | php | protected function preprocessElement(Element $element, Variables $variables) {
/** @var \Drupal\node\Entity\Node $node */
$node = $variables['node'];
$account = $node->getOwner();
$variables['content_type'] = $node->bundle();
// We get the group link to the node if there is one,
// will return ... | [
"protected",
"function",
"preprocessElement",
"(",
"Element",
"$",
"element",
",",
"Variables",
"$",
"variables",
")",
"{",
"/** @var \\Drupal\\node\\Entity\\Node $node */",
"$",
"node",
"=",
"$",
"variables",
"[",
"'node'",
"]",
";",
"$",
"account",
"=",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Node.php#L23-L236 |
goalgorilla/open_social | modules/social_features/social_tagging/src/Form/SocialTaggingSettingsForm.php | SocialTaggingSettingsForm.buildForm | public function buildForm(array $form, FormStateInterface $form_state) {
// Get the configuration file.
$config = $this->config('social_tagging.settings');
$content_types = [];
foreach (NodeType::loadMultiple() as $node_type) {
/* @var NodeType $node_type */
$content_types[] = $node_type->... | php | public function buildForm(array $form, FormStateInterface $form_state) {
// Get the configuration file.
$config = $this->config('social_tagging.settings');
$content_types = [];
foreach (NodeType::loadMultiple() as $node_type) {
/* @var NodeType $node_type */
$content_types[] = $node_type->... | [
"public",
"function",
"buildForm",
"(",
"array",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"// Get the configuration file.",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
"'social_tagging.settings'",
")",
";",
"$",
"content_types... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Form/SocialTaggingSettingsForm.php#L63-L118 |
goalgorilla/open_social | modules/social_features/social_tagging/src/Form/SocialTaggingSettingsForm.php | SocialTaggingSettingsForm.submitForm | public function submitForm(array &$form, FormStateInterface $form_state) {
// Get the configuration file.
$config = $this->config('social_tagging.settings');
$config->set('enable_content_tagging', $form_state->getValue('enable_content_tagging'))->save();
$config->set('allow_category_split', $form_state... | php | public function submitForm(array &$form, FormStateInterface $form_state) {
// Get the configuration file.
$config = $this->config('social_tagging.settings');
$config->set('enable_content_tagging', $form_state->getValue('enable_content_tagging'))->save();
$config->set('allow_category_split', $form_state... | [
"public",
"function",
"submitForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"// Get the configuration file.",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"(",
"'social_tagging.settings'",
")",
";",
"$",
"confi... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Form/SocialTaggingSettingsForm.php#L123-L138 |
goalgorilla/open_social | modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php | BlockedUsers.alterIndexedItems | public function alterIndexedItems(array &$items) {
foreach ($items as $item_id => $item) {
$object = $item->getOriginalObject()->getValue();
if ($object instanceof ProfileInterface) {
// Profile ownedId is the userId.
if ($object->getOwner()->isBlocked() === TRUE) {
unset($item... | php | public function alterIndexedItems(array &$items) {
foreach ($items as $item_id => $item) {
$object = $item->getOriginalObject()->getValue();
if ($object instanceof ProfileInterface) {
// Profile ownedId is the userId.
if ($object->getOwner()->isBlocked() === TRUE) {
unset($item... | [
"public",
"function",
"alterIndexedItems",
"(",
"array",
"&",
"$",
"items",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"item_id",
"=>",
"$",
"item",
")",
"{",
"$",
"object",
"=",
"$",
"item",
"->",
"getOriginalObject",
"(",
")",
"->",
"getValue... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php#L45-L60 |
goalgorilla/open_social | modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php | BlockedUsers.preprocessSearchQuery | public function preprocessSearchQuery(QueryInterface $query) {
if (!$query->getOption('search_api_bypass_access')) {
// Add a condition to filter out users through the status field.
$conditions = $query->createConditionGroup('AND');
$conditions->addCondition('user_status', 0, '<>');
// Add t... | php | public function preprocessSearchQuery(QueryInterface $query) {
if (!$query->getOption('search_api_bypass_access')) {
// Add a condition to filter out users through the status field.
$conditions = $query->createConditionGroup('AND');
$conditions->addCondition('user_status', 0, '<>');
// Add t... | [
"public",
"function",
"preprocessSearchQuery",
"(",
"QueryInterface",
"$",
"query",
")",
"{",
"if",
"(",
"!",
"$",
"query",
"->",
"getOption",
"(",
"'search_api_bypass_access'",
")",
")",
"{",
"// Add a condition to filter out users through the status field.",
"$",
"con... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Plugin/search_api/processor/BlockedUsers.php#L65-L73 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_enrolments_export/src/Plugin/Action/ExportEnrolments.php | ExportEnrolments.executeMultiple | public function executeMultiple(array $entities) {
/** @var \Drupal\social_event\EventEnrollmentInterface $entity */
foreach ($entities as &$entity) {
$entity = $this->getAccount($entity);
}
parent::executeMultiple($entities);
} | php | public function executeMultiple(array $entities) {
/** @var \Drupal\social_event\EventEnrollmentInterface $entity */
foreach ($entities as &$entity) {
$entity = $this->getAccount($entity);
}
parent::executeMultiple($entities);
} | [
"public",
"function",
"executeMultiple",
"(",
"array",
"$",
"entities",
")",
"{",
"/** @var \\Drupal\\social_event\\EventEnrollmentInterface $entity */",
"foreach",
"(",
"$",
"entities",
"as",
"&",
"$",
"entity",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_enrolments_export/src/Plugin/Action/ExportEnrolments.php#L26-L33 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_enrolments_export/src/Plugin/Action/ExportEnrolments.php | ExportEnrolments.access | public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
if ($object instanceof EventEnrollmentInterface) {
$access = $this->getAccount($object)->access('view', $account, TRUE);
}
else {
$access = AccessResult::forbidden();
}
return $return_as_objec... | php | public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
if ($object instanceof EventEnrollmentInterface) {
$access = $this->getAccount($object)->access('view', $account, TRUE);
}
else {
$access = AccessResult::forbidden();
}
return $return_as_objec... | [
"public",
"function",
"access",
"(",
"$",
"object",
",",
"AccountInterface",
"$",
"account",
"=",
"NULL",
",",
"$",
"return_as_object",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"EventEnrollmentInterface",
")",
"{",
"$",
"access",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_enrolments_export/src/Plugin/Action/ExportEnrolments.php#L38-L47 |
goalgorilla/open_social | modules/custom/dropdown/src/Element/Dropdown.php | Dropdown.processDropdown | public static function processDropdown(&$element, FormStateInterface $form_state, &$complete_form) {
if (count($element['#options']) > 0) {
$weight = 0;
foreach ($element['#options'] as $key => $option) {
$value = HtmlUtility::escape($option['value']);
$label = HtmlUtility::escape($optio... | php | public static function processDropdown(&$element, FormStateInterface $form_state, &$complete_form) {
if (count($element['#options']) > 0) {
$weight = 0;
foreach ($element['#options'] as $key => $option) {
$value = HtmlUtility::escape($option['value']);
$label = HtmlUtility::escape($optio... | [
"public",
"static",
"function",
"processDropdown",
"(",
"&",
"$",
"element",
",",
"FormStateInterface",
"$",
"form_state",
",",
"&",
"$",
"complete_form",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"element",
"[",
"'#options'",
"]",
")",
">",
"0",
")",
"{",... | Expands a radios element into individual radio elements. | [
"Expands",
"a",
"radios",
"element",
"into",
"individual",
"radio",
"elements",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Element/Dropdown.php#L48-L87 |
goalgorilla/open_social | modules/custom/dropdown/src/Element/Dropdown.php | Dropdown.valueCallback | public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
if ($input !== FALSE) {
// When there's user input (including NULL), return it as the value.
// However, if NULL is submitted, FormBuilder::handleInputElement() will
// apply the default value, and we want th... | php | public static function valueCallback(&$element, $input, FormStateInterface $form_state) {
if ($input !== FALSE) {
// When there's user input (including NULL), return it as the value.
// However, if NULL is submitted, FormBuilder::handleInputElement() will
// apply the default value, and we want th... | [
"public",
"static",
"function",
"valueCallback",
"(",
"&",
"$",
"element",
",",
"$",
"input",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"if",
"(",
"$",
"input",
"!==",
"FALSE",
")",
"{",
"// When there's user input (including NULL), return it as the va... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Element/Dropdown.php#L92-L116 |
goalgorilla/open_social | modules/custom/social_demo/src/Plugin/DemoContent/EventEnrollment.php | EventEnrollment.getEntry | public function getEntry(array $item) {
$uid = $this->loadByUuid('user', $item['uid'])->id();
$entry = parent::getEntry($item);
return $entry + [
'langcode' => $item['langcode'],
'name' => substr($item['title'], 0, 50),
'user_id' => $uid,
'created' => \Drupal::time()->getRequestTime... | php | public function getEntry(array $item) {
$uid = $this->loadByUuid('user', $item['uid'])->id();
$entry = parent::getEntry($item);
return $entry + [
'langcode' => $item['langcode'],
'name' => substr($item['title'], 0, 50),
'user_id' => $uid,
'created' => \Drupal::time()->getRequestTime... | [
"public",
"function",
"getEntry",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"uid",
"=",
"$",
"this",
"->",
"loadByUuid",
"(",
"'user'",
",",
"$",
"item",
"[",
"'uid'",
"]",
")",
"->",
"id",
"(",
")",
";",
"$",
"entry",
"=",
"parent",
"::",
"getEn... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/EventEnrollment.php#L22-L35 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/FormElementLabel.php | FormElementLabel.preprocessElement | public function preprocessElement(Element $element, Variables $variables) {
if (isset($element['#id'])) {
if (strpos($element['#id'], 'field-visibility') !== FALSE) {
if (isset($element['#attributes']['title'])) {
$description = $element['#attributes']['title'];
$element['#attribu... | php | public function preprocessElement(Element $element, Variables $variables) {
if (isset($element['#id'])) {
if (strpos($element['#id'], 'field-visibility') !== FALSE) {
if (isset($element['#attributes']['title'])) {
$description = $element['#attributes']['title'];
$element['#attribu... | [
"public",
"function",
"preprocessElement",
"(",
"Element",
"$",
"element",
",",
"Variables",
"$",
"variables",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"element",
"[",
"'#id'",
"]",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"element",
"[",
"'#id'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/FormElementLabel.php#L21-L72 |
goalgorilla/open_social | modules/custom/social_demo/src/Plugin/DemoContent/Topic.php | Topic.getEntry | protected function getEntry(array $item) {
$entry = parent::getEntry($item);
$entry['field_content_visibility'] = $item['field_content_visibility'];
// Load term by name and set to node.
if (!empty($item['field_topic_type'])) {
$entry['field_topic_type'] = $this->prepareTopicType($item['field_top... | php | protected function getEntry(array $item) {
$entry = parent::getEntry($item);
$entry['field_content_visibility'] = $item['field_content_visibility'];
// Load term by name and set to node.
if (!empty($item['field_topic_type'])) {
$entry['field_topic_type'] = $this->prepareTopicType($item['field_top... | [
"protected",
"function",
"getEntry",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"entry",
"=",
"parent",
"::",
"getEntry",
"(",
"$",
"item",
")",
";",
"$",
"entry",
"[",
"'field_content_visibility'",
"]",
"=",
"$",
"item",
"[",
"'field_content_visibility'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Topic.php#L68-L88 |
goalgorilla/open_social | modules/custom/social_demo/src/Plugin/DemoContent/Topic.php | Topic.prepareTopicType | protected function prepareTopicType($name) {
$value = NULL;
$terms = $this->termStorage->loadByProperties([
'name' => $name,
]);
if ($terms) {
$value = [
[
'target_id' => current($terms)->id(),
],
];
}
return $value;
} | php | protected function prepareTopicType($name) {
$value = NULL;
$terms = $this->termStorage->loadByProperties([
'name' => $name,
]);
if ($terms) {
$value = [
[
'target_id' => current($terms)->id(),
],
];
}
return $value;
} | [
"protected",
"function",
"prepareTopicType",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"NULL",
";",
"$",
"terms",
"=",
"$",
"this",
"->",
"termStorage",
"->",
"loadByProperties",
"(",
"[",
"'name'",
"=>",
"$",
"name",
",",
"]",
")",
";",
"if",
"... | Returns taxonomy term id.
@param string $name
Term name.
@return array|null
Array containing related terms. | [
"Returns",
"taxonomy",
"term",
"id",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Topic.php#L140-L155 |
goalgorilla/open_social | modules/custom/social_demo/src/DemoUser.php | DemoUser.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("User 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("User 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/DemoUser.php#L72-L143 |
goalgorilla/open_social | modules/custom/social_demo/src/DemoUser.php | DemoUser.getEntry | protected function getEntry(array $item) {
$entry = [
'uuid' => $item['uuid'],
'name' => $item['name'],
'mail' => $item['mail'],
'init' => $item['mail'],
'timezone' => $item['timezone'],
'status' => $item['status'],
'created' => \Drupal::time()->getRequestTime(),
'cha... | php | protected function getEntry(array $item) {
$entry = [
'uuid' => $item['uuid'],
'name' => $item['name'],
'mail' => $item['mail'],
'init' => $item['mail'],
'timezone' => $item['timezone'],
'status' => $item['status'],
'created' => \Drupal::time()->getRequestTime(),
'cha... | [
"protected",
"function",
"getEntry",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"entry",
"=",
"[",
"'uuid'",
"=>",
"$",
"item",
"[",
"'uuid'",
"]",
",",
"'name'",
"=>",
"$",
"item",
"[",
"'name'",
"]",
",",
"'mail'",
"=>",
"$",
"item",
"[",
"'mail'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoUser.php#L148-L162 |
goalgorilla/open_social | modules/custom/social_demo/src/DemoUser.php | DemoUser.prepareTerms | protected function prepareTerms(array $values) {
$terms = [];
foreach ($values as $uuid) {
$term = $this->termStorage->loadByProperties([
'uuid' => $uuid,
]);
$term = reset($term);
if (!empty($term)) {
$terms[] = [
'target_id' => $term->id(),
];
... | php | protected function prepareTerms(array $values) {
$terms = [];
foreach ($values as $uuid) {
$term = $this->termStorage->loadByProperties([
'uuid' => $uuid,
]);
$term = reset($term);
if (!empty($term)) {
$terms[] = [
'target_id' => $term->id(),
];
... | [
"protected",
"function",
"prepareTerms",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"terms",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"uuid",
")",
"{",
"$",
"term",
"=",
"$",
"this",
"->",
"termStorage",
"->",
"loadByProperties",
... | Returns taxonomy terms for UUIDs.
@param array $values
A list of UUIDs for terms.
@return array
Returns an empty array or one filled with taxonomy terms. | [
"Returns",
"taxonomy",
"terms",
"for",
"UUIDs",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoUser.php#L173-L190 |
goalgorilla/open_social | modules/custom/social_demo/src/DemoUser.php | DemoUser.fillProfile | protected function fillProfile(ProfileInterface $profile, array $item) {
$profile->field_profile_image = $item['image'];
$profile->field_profile_first_name = $item['first_name'];
$profile->field_profile_last_name = $item['last_name'];
$profile->field_profile_organization = $item['organization'];
$pr... | php | protected function fillProfile(ProfileInterface $profile, array $item) {
$profile->field_profile_image = $item['image'];
$profile->field_profile_first_name = $item['first_name'];
$profile->field_profile_last_name = $item['last_name'];
$profile->field_profile_organization = $item['organization'];
$pr... | [
"protected",
"function",
"fillProfile",
"(",
"ProfileInterface",
"$",
"profile",
",",
"array",
"$",
"item",
")",
"{",
"$",
"profile",
"->",
"field_profile_image",
"=",
"$",
"item",
"[",
"'image'",
"]",
";",
"$",
"profile",
"->",
"field_profile_first_name",
"="... | Fills the some fields of a profile.
@param \Drupal\profile\Entity\ProfileInterface $profile
Type of ProfileInterface.
@param array $item
The profile field item. | [
"Fills",
"the",
"some",
"fields",
"of",
"a",
"profile",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoUser.php#L200-L211 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php | EventAnEnrollManager.getGuestName | public function getGuestName(EventEnrollmentInterface $entity, $email = TRUE) {
$parts = [];
// If user doesn't have access to see the first/last/email value.
// Lets return guest.
if (!social_event_manager_or_organizer()) {
return $this->t('Guest');
}
if (!$entity->field_first_name->isE... | php | public function getGuestName(EventEnrollmentInterface $entity, $email = TRUE) {
$parts = [];
// If user doesn't have access to see the first/last/email value.
// Lets return guest.
if (!social_event_manager_or_organizer()) {
return $this->t('Guest');
}
if (!$entity->field_first_name->isE... | [
"public",
"function",
"getGuestName",
"(",
"EventEnrollmentInterface",
"$",
"entity",
",",
"$",
"email",
"=",
"TRUE",
")",
"{",
"$",
"parts",
"=",
"[",
"]",
";",
"// If user doesn't have access to see the first/last/email value.",
"// Lets return guest.",
"if",
"(",
"... | Returns guest name.
@param \Drupal\social_event\EventEnrollmentInterface $entity
The event enrollment.
@param bool $email
TRUE if can show E-mail address when first and last names is not set.
@return string
Full name or E-mail address. | [
"Returns",
"guest",
"name",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php#L26-L48 |
goalgorilla/open_social | modules/custom/activity_creator/src/Plugin/ActivityDestinationBase.php | ActivityDestinationBase.isActiveInView | public function isActiveInView($view) {
if (isset($view->filter['field_activity_destinations_value']->value[$this->pluginId])) {
if ($view->filter['field_activity_destinations_value']->value[$this->pluginId] === $this->pluginId) {
return TRUE;
}
}
return FALSE;
} | php | public function isActiveInView($view) {
if (isset($view->filter['field_activity_destinations_value']->value[$this->pluginId])) {
if ($view->filter['field_activity_destinations_value']->value[$this->pluginId] === $this->pluginId) {
return TRUE;
}
}
return FALSE;
} | [
"public",
"function",
"isActiveInView",
"(",
"$",
"view",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"view",
"->",
"filter",
"[",
"'field_activity_destinations_value'",
"]",
"->",
"value",
"[",
"$",
"this",
"->",
"pluginId",
"]",
")",
")",
"{",
"if",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/Plugin/ActivityDestinationBase.php#L22-L29 |
goalgorilla/open_social | modules/social_features/social_mentions/src/Controller/AutocompleteController.php | AutocompleteController.suggestions | public function suggestions(Request $request) {
$name = $request->get('term');
$config = $this->configFactory->get('mentions.settings');
$suggestion_format = $config->get('suggestions_format');
$suggestion_amount = $config->get('suggestions_amount');
$result = $this->getUserIdsFromName($name, $sugge... | php | public function suggestions(Request $request) {
$name = $request->get('term');
$config = $this->configFactory->get('mentions.settings');
$suggestion_format = $config->get('suggestions_format');
$suggestion_amount = $config->get('suggestions_amount');
$result = $this->getUserIdsFromName($name, $sugge... | [
"public",
"function",
"suggestions",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"name",
"=",
"$",
"request",
"->",
"get",
"(",
"'term'",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"configFactory",
"->",
"get",
"(",
"'mentions.settings'",
")",
... | Function for suggestions.
@param \Symfony\Component\HttpFoundation\Request $request
The request.
@return \Symfony\Component\HttpFoundation\JsonResponse
Returns a JsonResponse. | [
"Function",
"for",
"suggestions",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_mentions/src/Controller/AutocompleteController.php#L83-L115 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/Details.php | Details.preprocess | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// Do not display the details title in file upload widget.
if (isset($variables['element']['#theme']) && $variables['element']['#theme'] == 'file_widget_multiple') {
$variables['title'] =... | php | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// Do not display the details title in file upload widget.
if (isset($variables['element']['#theme']) && $variables['element']['#theme'] == 'file_widget_multiple') {
$variables['title'] =... | [
"public",
"function",
"preprocess",
"(",
"array",
"&",
"$",
"variables",
",",
"$",
"hook",
",",
"array",
"$",
"info",
")",
"{",
"parent",
"::",
"preprocess",
"(",
"$",
"variables",
",",
"$",
"hook",
",",
"$",
"info",
")",
";",
"// Do not display the deta... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Details.php#L19-L27 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_managers/src/Controller/EventManagersController.php | EventManagersController.access | public function access(AccountInterface $account, RouteMatch $route_match) {
if ($account->hasPermission('manage everything enrollments')) {
return AccessResult::allowed();
}
else {
/** @var \Drupal\node\NodeInterface $node */
$node = $route_match->getParameter('node');
if (!$node i... | php | public function access(AccountInterface $account, RouteMatch $route_match) {
if ($account->hasPermission('manage everything enrollments')) {
return AccessResult::allowed();
}
else {
/** @var \Drupal\node\NodeInterface $node */
$node = $route_match->getParameter('node');
if (!$node i... | [
"public",
"function",
"access",
"(",
"AccountInterface",
"$",
"account",
",",
"RouteMatch",
"$",
"route_match",
")",
"{",
"if",
"(",
"$",
"account",
"->",
"hasPermission",
"(",
"'manage everything enrollments'",
")",
")",
"{",
"return",
"AccessResult",
"::",
"al... | Checks access for manage all enrollment page.
@param \Drupal\Core\Session\AccountInterface $account
Run access checks for this account.
@param \Drupal\Core\Routing\RouteMatch $route_match
Current route.
@return \Drupal\Core\Access\AccessResult
Check standard and custom permissions.
@throws \Drupal\Component\Plugin\E... | [
"Checks",
"access",
"for",
"manage",
"all",
"enrollment",
"page",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_managers/src/Controller/EventManagersController.php#L62-L90 |
goalgorilla/open_social | modules/social_features/social_post/src/PostViewBuilder.php | PostViewBuilder.createInstance | public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static(
$entity_type,
$container->get('entity.manager'),
$container->get('language_manager'),
$container->get('theme.registry'),
$container->get('social_group.helper_serv... | php | public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {
return new static(
$entity_type,
$container->get('entity.manager'),
$container->get('language_manager'),
$container->get('theme.registry'),
$container->get('social_group.helper_serv... | [
"public",
"static",
"function",
"createInstance",
"(",
"ContainerInterface",
"$",
"container",
",",
"EntityTypeInterface",
"$",
"entity_type",
")",
"{",
"return",
"new",
"static",
"(",
"$",
"entity_type",
",",
"$",
"container",
"->",
"get",
"(",
"'entity.manager'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostViewBuilder.php#L52-L60 |
goalgorilla/open_social | modules/social_features/social_post/src/PostViewBuilder.php | PostViewBuilder.buildComponents | public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
if (empty($entities)) {
return;
}
parent::buildComponents($build, $entities, $displays, $view_mode);
foreach ($entities as $id => $entity) {
$build[$id]['links'] = [
'#lazy_builder' => [... | php | public function buildComponents(array &$build, array $entities, array $displays, $view_mode) {
if (empty($entities)) {
return;
}
parent::buildComponents($build, $entities, $displays, $view_mode);
foreach ($entities as $id => $entity) {
$build[$id]['links'] = [
'#lazy_builder' => [... | [
"public",
"function",
"buildComponents",
"(",
"array",
"&",
"$",
"build",
",",
"array",
"$",
"entities",
",",
"array",
"$",
"displays",
",",
"$",
"view_mode",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"entities",
")",
")",
"{",
"return",
";",
"}",
"par... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostViewBuilder.php#L65-L157 |
goalgorilla/open_social | modules/social_features/social_post/src/PostViewBuilder.php | PostViewBuilder.renderLinks | public static function renderLinks($post_entity_id, $view_mode, $langcode, $is_in_preview) {
$links = [
'#theme' => 'links',
'#pre_render' => ['drupal_pre_render_links'],
'#attributes' => ['class' => ['links', 'inline']],
];
if (!$is_in_preview) {
$entity = Post::load($post_entity_i... | php | public static function renderLinks($post_entity_id, $view_mode, $langcode, $is_in_preview) {
$links = [
'#theme' => 'links',
'#pre_render' => ['drupal_pre_render_links'],
'#attributes' => ['class' => ['links', 'inline']],
];
if (!$is_in_preview) {
$entity = Post::load($post_entity_i... | [
"public",
"static",
"function",
"renderLinks",
"(",
"$",
"post_entity_id",
",",
"$",
"view_mode",
",",
"$",
"langcode",
",",
"$",
"is_in_preview",
")",
"{",
"$",
"links",
"=",
"[",
"'#theme'",
"=>",
"'links'",
",",
"'#pre_render'",
"=>",
"[",
"'drupal_pre_re... | Lazy_builder callback; builds a post's links.
@param string $post_entity_id
The post entity ID.
@param string $view_mode
The view mode in which the post entity is being viewed.
@param string $langcode
The language in which the post entity is being viewed.
@param bool $is_in_preview
Whether the post is currently being ... | [
"Lazy_builder",
"callback",
";",
"builds",
"a",
"post",
"s",
"links",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostViewBuilder.php#L174-L193 |
goalgorilla/open_social | modules/social_features/social_post/src/PostViewBuilder.php | PostViewBuilder.buildLinks | protected static function buildLinks(Post $entity, $view_mode) {
$links = [];
if ($entity->access('update') && $entity->hasLinkTemplate('edit-form')) {
$links['edit'] = [
'title' => t('Edit'),
'weight' => 10,
'url' => $entity->urlInfo('edit-form'),
'query' => ['destination... | php | protected static function buildLinks(Post $entity, $view_mode) {
$links = [];
if ($entity->access('update') && $entity->hasLinkTemplate('edit-form')) {
$links['edit'] = [
'title' => t('Edit'),
'weight' => 10,
'url' => $entity->urlInfo('edit-form'),
'query' => ['destination... | [
"protected",
"static",
"function",
"buildLinks",
"(",
"Post",
"$",
"entity",
",",
"$",
"view_mode",
")",
"{",
"$",
"links",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"entity",
"->",
"access",
"(",
"'update'",
")",
"&&",
"$",
"entity",
"->",
"hasLinkTemplate"... | Build the default links (Read more) for a post.
@param \Drupal\social_post\Entity\Post $entity
The post object.
@param string $view_mode
A view mode identifier.
@return array
An array that can be processed by drupal_pre_render_links(). | [
"Build",
"the",
"default",
"links",
"(",
"Read",
"more",
")",
"for",
"a",
"post",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/PostViewBuilder.php#L206-L231 |
goalgorilla/open_social | modules/social_features/social_post/src/Plugin/views/filter/PostGroupStream.php | PostGroupStream.query | public function query() {
// Get the group.
$group = \Drupal::routeMatch()->getParameter('group');
// Visibility logic when visiting a post stream on group page:
// - All the posts to the group by you and other users in the community.
$this->query->addTable('post__field_visibility');
$this->qu... | php | public function query() {
// Get the group.
$group = \Drupal::routeMatch()->getParameter('group');
// Visibility logic when visiting a post stream on group page:
// - All the posts to the group by you and other users in the community.
$this->query->addTable('post__field_visibility');
$this->qu... | [
"public",
"function",
"query",
"(",
")",
"{",
"// Get the group.",
"$",
"group",
"=",
"\\",
"Drupal",
"::",
"routeMatch",
"(",
")",
"->",
"getParameter",
"(",
"'group'",
")",
";",
"// Visibility logic when visiting a post stream on group page:",
"// - All the posts to t... | Query for the activity stream on the group pages. | [
"Query",
"for",
"the",
"activity",
"stream",
"on",
"the",
"group",
"pages",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/views/filter/PostGroupStream.php#L41-L57 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php | FieldDropdown.preprocess | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
if (isset($variables['active']) && is_numeric($variables['active'])) {
$title = $variables['element'][$variables['active']]['#title'];
$selected_icon = _socialbase_get_visibility_icon($... | php | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
if (isset($variables['active']) && is_numeric($variables['active'])) {
$title = $variables['element'][$variables['active']]['#title'];
$selected_icon = _socialbase_get_visibility_icon($... | [
"public",
"function",
"preprocess",
"(",
"array",
"&",
"$",
"variables",
",",
"$",
"hook",
",",
"array",
"$",
"info",
")",
"{",
"parent",
"::",
"preprocess",
"(",
"$",
"variables",
",",
"$",
"hook",
",",
"$",
"info",
")",
";",
"if",
"(",
"isset",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/FieldDropdown.php#L19-L28 |
goalgorilla/open_social | modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php | EnrollActionBlock.blockAccess | protected function blockAccess(AccountInterface $account) {
$route_name = $this->routeMatch->getRouteName();
$routes_to_check = [
'view.event_enrollments.view_enrollments',
'entity.node.canonical',
'view.managers.view_managers',
];
if (in_array($route_name, $routes_to_check)) {
$... | php | protected function blockAccess(AccountInterface $account) {
$route_name = $this->routeMatch->getRouteName();
$routes_to_check = [
'view.event_enrollments.view_enrollments',
'entity.node.canonical',
'view.managers.view_managers',
];
if (in_array($route_name, $routes_to_check)) {
$... | [
"protected",
"function",
"blockAccess",
"(",
"AccountInterface",
"$",
"account",
")",
"{",
"$",
"route_name",
"=",
"$",
"this",
"->",
"routeMatch",
"->",
"getRouteName",
"(",
")",
";",
"$",
"routes_to_check",
"=",
"[",
"'view.event_enrollments.view_enrollments'",
... | {@inheritdoc}
Custom access logic to display the block on the hero region for an event. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php#L76-L107 |
goalgorilla/open_social | modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php | EnrollActionBlock.build | public function build() {
$form = $this->formBuilder->getForm('Drupal\social_event\Form\EnrollActionForm');
$render_array = [
'enroll_action_form' => $form,
];
$text = (string) $this->t('You have enrolled for this event.');
// Add extra text to.
if ($form['to_enroll_status']['#value'] =... | php | public function build() {
$form = $this->formBuilder->getForm('Drupal\social_event\Form\EnrollActionForm');
$render_array = [
'enroll_action_form' => $form,
];
$text = (string) $this->t('You have enrolled for this event.');
// Add extra text to.
if ($form['to_enroll_status']['#value'] =... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"formBuilder",
"->",
"getForm",
"(",
"'Drupal\\social_event\\Form\\EnrollActionForm'",
")",
";",
"$",
"render_array",
"=",
"[",
"'enroll_action_form'",
"=>",
"$",
"form",
",",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php#L112-L129 |
goalgorilla/open_social | modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsBatch.php | SocialProfileFieldsBatch.performFlush | public static function performFlush(array $pids, array $fields, array &$context) {
$message = 'Flushing profile data...';
$results = [];
foreach ($pids as $pid) {
$profile = Profile::load($pid);
foreach ($fields as $field_name) {
// Check if the field exists.
if ($profile->has... | php | public static function performFlush(array $pids, array $fields, array &$context) {
$message = 'Flushing profile data...';
$results = [];
foreach ($pids as $pid) {
$profile = Profile::load($pid);
foreach ($fields as $field_name) {
// Check if the field exists.
if ($profile->has... | [
"public",
"static",
"function",
"performFlush",
"(",
"array",
"$",
"pids",
",",
"array",
"$",
"fields",
",",
"array",
"&",
"$",
"context",
")",
"{",
"$",
"message",
"=",
"'Flushing profile data...'",
";",
"$",
"results",
"=",
"[",
"]",
";",
"foreach",
"(... | Perform the flush.
@param array $pids
Profile id's.
@param array $fields
An array of fields to empty.
@param array $context
The context of the flush. | [
"Perform",
"the",
"flush",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsBatch.php#L28-L50 |
goalgorilla/open_social | modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsBatch.php | SocialProfileFieldsBatch.performFlushFinishedCallback | public function performFlushFinishedCallback($success, array $results, $operations) {
// The 'success' parameter means no fatal PHP errors were detected. All
// other error management should be handled using 'results'.
if ($success) {
$message = \Drupal::translation()->formatPlural(
count($res... | php | public function performFlushFinishedCallback($success, array $results, $operations) {
// The 'success' parameter means no fatal PHP errors were detected. All
// other error management should be handled using 'results'.
if ($success) {
$message = \Drupal::translation()->formatPlural(
count($res... | [
"public",
"function",
"performFlushFinishedCallback",
"(",
"$",
"success",
",",
"array",
"$",
"results",
",",
"$",
"operations",
")",
"{",
"// The 'success' parameter means no fatal PHP errors were detected. All",
"// other error management should be handled using 'results'.",
"if"... | Message when done.
@param bool $success
If the operation was a success.
@param array $results
The amount of items done.
@param string $operations
The operation performed. | [
"Message",
"when",
"done",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/modules/social_profile_fields/src/SocialProfileFieldsBatch.php#L62-L87 |
goalgorilla/open_social | modules/social_features/social_topic/src/Routing/RouteSubscriber.php | RouteSubscriber.alterRoutes | protected function alterRoutes(RouteCollection $collection) {
// Override default title for the latest topics view.
if ($route = $collection->get('view.latest_topics.page_latest_topics')) {
$defaults = $route->getDefaults();
$defaults['_title_callback'] = '\Drupal\social_topic\Controller\SocialTopi... | php | protected function alterRoutes(RouteCollection $collection) {
// Override default title for the latest topics view.
if ($route = $collection->get('view.latest_topics.page_latest_topics')) {
$defaults = $route->getDefaults();
$defaults['_title_callback'] = '\Drupal\social_topic\Controller\SocialTopi... | [
"protected",
"function",
"alterRoutes",
"(",
"RouteCollection",
"$",
"collection",
")",
"{",
"// Override default title for the latest topics view.",
"if",
"(",
"$",
"route",
"=",
"$",
"collection",
"->",
"get",
"(",
"'view.latest_topics.page_latest_topics'",
")",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_topic/src/Routing/RouteSubscriber.php#L19-L34 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/views/field/SocialEventAnEnrollViewsBulkOperationsBulkForm.php | SocialEventAnEnrollViewsBulkOperationsBulkForm.getEntityLabel | public function getEntityLabel(EntityInterface $entity) {
/** @var \Drupal\social_event\EventEnrollmentInterface $entity */
if ($this->socialEventAnEnrollManager->isGuest($entity)) {
return $this->socialEventAnEnrollManager->getGuestName($entity);
}
return parent::getEntityLabel($entity);
} | php | public function getEntityLabel(EntityInterface $entity) {
/** @var \Drupal\social_event\EventEnrollmentInterface $entity */
if ($this->socialEventAnEnrollManager->isGuest($entity)) {
return $this->socialEventAnEnrollManager->getGuestName($entity);
}
return parent::getEntityLabel($entity);
} | [
"public",
"function",
"getEntityLabel",
"(",
"EntityInterface",
"$",
"entity",
")",
"{",
"/** @var \\Drupal\\social_event\\EventEnrollmentInterface $entity */",
"if",
"(",
"$",
"this",
"->",
"socialEventAnEnrollManager",
"->",
"isGuest",
"(",
"$",
"entity",
")",
")",
"{... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/views/field/SocialEventAnEnrollViewsBulkOperationsBulkForm.php#L96-L103 |
goalgorilla/open_social | modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php | FacebookAuthController.userLoginCallback | public function userLoginCallback() {
$sdk = $this->getSdk('login');
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$this->authManager->setSdk($sdk);
$profile = $this->getProfile('login');
if ($profile instanceof RedirectResponse) {
return $profile;
}
// Check whe... | php | public function userLoginCallback() {
$sdk = $this->getSdk('login');
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$this->authManager->setSdk($sdk);
$profile = $this->getProfile('login');
if ($profile instanceof RedirectResponse) {
return $profile;
}
// Check whe... | [
"public",
"function",
"userLoginCallback",
"(",
")",
"{",
"$",
"sdk",
"=",
"$",
"this",
"->",
"getSdk",
"(",
"'login'",
")",
";",
"if",
"(",
"$",
"sdk",
"instanceof",
"RedirectResponse",
")",
"{",
"return",
"$",
"sdk",
";",
"}",
"$",
"this",
"->",
"a... | Authorizes the user after redirect from Facebook.
@return \Symfony\Component\HttpFoundation\RedirectResponse
Returns a RedirectResponse. | [
"Authorizes",
"the",
"user",
"after",
"redirect",
"from",
"Facebook",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php#L84-L125 |
goalgorilla/open_social | modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php | FacebookAuthController.userRegisterCallback | public function userRegisterCallback() {
$sdk = $this->getSdk('register');
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$this->authManager->setSdk($sdk);
$profile = $this->getProfile('register');
if ($profile instanceof RedirectResponse) {
return $profile;
}
// ... | php | public function userRegisterCallback() {
$sdk = $this->getSdk('register');
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$this->authManager->setSdk($sdk);
$profile = $this->getProfile('register');
if ($profile instanceof RedirectResponse) {
return $profile;
}
// ... | [
"public",
"function",
"userRegisterCallback",
"(",
")",
"{",
"$",
"sdk",
"=",
"$",
"this",
"->",
"getSdk",
"(",
"'register'",
")",
";",
"if",
"(",
"$",
"sdk",
"instanceof",
"RedirectResponse",
")",
"{",
"return",
"$",
"sdk",
";",
"}",
"$",
"this",
"->"... | Registers the new account after redirect from Facebook.
@return \Symfony\Component\HttpFoundation\RedirectResponse
Return a RedirectResponse. | [
"Registers",
"the",
"new",
"account",
"after",
"redirect",
"from",
"Facebook",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php#L142-L192 |
goalgorilla/open_social | modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php | FacebookAuthController.getSdk | public function getSdk($type) {
$network_manager = $this->networkManager->createInstance('social_auth_facebook');
if (!$network_manager->isActive()) {
drupal_set_message($this->t('@network is disabled. Contact the site administrator', [
'@network' => $this->t('Facebook'),
]), 'error');
... | php | public function getSdk($type) {
$network_manager = $this->networkManager->createInstance('social_auth_facebook');
if (!$network_manager->isActive()) {
drupal_set_message($this->t('@network is disabled. Contact the site administrator', [
'@network' => $this->t('Facebook'),
]), 'error');
... | [
"public",
"function",
"getSdk",
"(",
"$",
"type",
")",
"{",
"$",
"network_manager",
"=",
"$",
"this",
"->",
"networkManager",
"->",
"createInstance",
"(",
"'social_auth_facebook'",
")",
";",
"if",
"(",
"!",
"$",
"network_manager",
"->",
"isActive",
"(",
")",... | Returns the SDK instance or RedirectResponse when error occurred.
@param string $type
Type of action, "login" or "register".
@return mixed|\Symfony\Component\HttpFoundation\RedirectResponse
Returns an instance of the SDK or a Redirect Response. | [
"Returns",
"the",
"SDK",
"instance",
"or",
"RedirectResponse",
"when",
"error",
"occurred",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_facebook/src/Controller/FacebookAuthController.php#L203-L221 |
goalgorilla/open_social | modules/custom/mentions/src/Plugin/Mentions/Entity.php | Entity.create | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$token = $container->get('token');
$entity_manager = $container->get('entity.manager');
$entity_query = $container->get('entity.query');
return new static(
$token,
$entity_man... | php | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$token = $container->get('token');
$entity_manager = $container->get('entity.manager');
$entity_query = $container->get('entity.query');
return new static(
$token,
$entity_man... | [
"public",
"static",
"function",
"create",
"(",
"ContainerInterface",
"$",
"container",
",",
"array",
"$",
"configuration",
",",
"$",
"plugin_id",
",",
"$",
"plugin_definition",
")",
"{",
"$",
"token",
"=",
"$",
"container",
"->",
"get",
"(",
"'token'",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Mentions/Entity.php#L39-L48 |
goalgorilla/open_social | modules/custom/mentions/src/Plugin/Mentions/Entity.php | Entity.outputCallback | public function outputCallback($mention, $settings) {
$entity = $this->entityManager->getStorage($mention['target']['entity_type'])
->load($mention['target']['entity_id']);
$output['value'] = $this->tokenService->replace($settings['value'], [$mention['target']['entity_type'] => $entity]);
if ($setting... | php | public function outputCallback($mention, $settings) {
$entity = $this->entityManager->getStorage($mention['target']['entity_type'])
->load($mention['target']['entity_id']);
$output['value'] = $this->tokenService->replace($settings['value'], [$mention['target']['entity_type'] => $entity]);
if ($setting... | [
"public",
"function",
"outputCallback",
"(",
"$",
"mention",
",",
"$",
"settings",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"entityManager",
"->",
"getStorage",
"(",
"$",
"mention",
"[",
"'target'",
"]",
"[",
"'entity_type'",
"]",
")",
"->",
"loa... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Mentions/Entity.php#L53-L61 |
goalgorilla/open_social | modules/custom/mentions/src/Plugin/Mentions/Entity.php | Entity.targetCallback | public function targetCallback($value, $settings) {
$entity_type = $settings['entity_type'];
$input_value = $settings['value'];
$query = $this->entityQueryService->get($entity_type);
$result = $query->condition($input_value, $value)->execute();
if (!empty($result)) {
$result = reset($result);... | php | public function targetCallback($value, $settings) {
$entity_type = $settings['entity_type'];
$input_value = $settings['value'];
$query = $this->entityQueryService->get($entity_type);
$result = $query->condition($input_value, $value)->execute();
if (!empty($result)) {
$result = reset($result);... | [
"public",
"function",
"targetCallback",
"(",
"$",
"value",
",",
"$",
"settings",
")",
"{",
"$",
"entity_type",
"=",
"$",
"settings",
"[",
"'entity_type'",
"]",
";",
"$",
"input_value",
"=",
"$",
"settings",
"[",
"'value'",
"]",
";",
"$",
"query",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Plugin/Mentions/Entity.php#L66-L82 |
goalgorilla/open_social | modules/custom/social_gdpr/src/Subscriber/Redirect.php | Redirect.checkForRedirection | public function checkForRedirection(GetResponseEvent $event) {
if ($this->routeMatch->getRouteName() != 'entity.data_policy.version_history') {
return;
}
if ($this->currentUser->id() == 1 || !$this->currentUser->hasPermission('view all data policy revisions')) {
return;
}
$url = Url::f... | php | public function checkForRedirection(GetResponseEvent $event) {
if ($this->routeMatch->getRouteName() != 'entity.data_policy.version_history') {
return;
}
if ($this->currentUser->id() == 1 || !$this->currentUser->hasPermission('view all data policy revisions')) {
return;
}
$url = Url::f... | [
"public",
"function",
"checkForRedirection",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"routeMatch",
"->",
"getRouteName",
"(",
")",
"!=",
"'entity.data_policy.version_history'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$"... | This method is called when the KernelEvents::REQUEST event is dispatched.
@param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
The event. | [
"This",
"method",
"is",
"called",
"when",
"the",
"KernelEvents",
"::",
"REQUEST",
"event",
"is",
"dispatched",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_gdpr/src/Subscriber/Redirect.php#L61-L73 |
goalgorilla/open_social | modules/custom/social_demo/src/DemoTaxonomyTerm.php | DemoTaxonomyTerm.getEntry | protected function getEntry(array $item) {
$entry = [
'uuid' => $item['uuid'],
'name' => $item['name'],
'vid' => $item['vid'],
'created' => \Drupal::time()->getRequestTime(),
];
return $entry;
} | php | protected function getEntry(array $item) {
$entry = [
'uuid' => $item['uuid'],
'name' => $item['name'],
'vid' => $item['vid'],
'created' => \Drupal::time()->getRequestTime(),
];
return $entry;
} | [
"protected",
"function",
"getEntry",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"entry",
"=",
"[",
"'uuid'",
"=>",
"$",
"item",
"[",
"'uuid'",
"]",
",",
"'name'",
"=>",
"$",
"item",
"[",
"'name'",
"]",
",",
"'vid'",
"=>",
"$",
"item",
"[",
"'vid'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoTaxonomyTerm.php#L74-L83 |
goalgorilla/open_social | modules/custom/social_demo/src/Plugin/DemoContent/Book.php | Book.getEntry | protected function getEntry(array $item) {
$entry = parent::getEntry($item);
$entry['field_content_visibility'] = $item['field_content_visibility'];
// Load image by uuid and set to node.
if (!empty($item['field_book_image'])) {
$entry['field_book_image'] = $this->prepareImage($item['image'], $it... | php | protected function getEntry(array $item) {
$entry = parent::getEntry($item);
$entry['field_content_visibility'] = $item['field_content_visibility'];
// Load image by uuid and set to node.
if (!empty($item['field_book_image'])) {
$entry['field_book_image'] = $this->prepareImage($item['image'], $it... | [
"protected",
"function",
"getEntry",
"(",
"array",
"$",
"item",
")",
"{",
"$",
"entry",
"=",
"parent",
"::",
"getEntry",
"(",
"$",
"item",
")",
";",
"$",
"entry",
"[",
"'field_content_visibility'",
"]",
"=",
"$",
"item",
"[",
"'field_content_visibility'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Book.php#L69-L118 |
goalgorilla/open_social | modules/social_features/social_user/src/Element/AccountHeaderElement.php | AccountHeaderElement.preRenderAccountHeaderElement | public static function preRenderAccountHeaderElement(array $item) {
// Retrieve the item children, if any, sorted by weight.
$children = Element::children($item, TRUE);
// The link attributes are for the top level link containe in the <li>.
$link_attributes = [];
// The link text is a label with a... | php | public static function preRenderAccountHeaderElement(array $item) {
// Retrieve the item children, if any, sorted by weight.
$children = Element::children($item, TRUE);
// The link attributes are for the top level link containe in the <li>.
$link_attributes = [];
// The link text is a label with a... | [
"public",
"static",
"function",
"preRenderAccountHeaderElement",
"(",
"array",
"$",
"item",
")",
"{",
"// Retrieve the item children, if any, sorted by weight.",
"$",
"children",
"=",
"Element",
"::",
"children",
"(",
"$",
"item",
",",
"TRUE",
")",
";",
"// The link a... | Returns an array that can be provided as an item in an item_list.
@param array $item
The render array for this account header element as defined in getInfo.
@return array
A render array for an element usable in item_list. | [
"Returns",
"an",
"array",
"that",
"can",
"be",
"provided",
"as",
"an",
"item",
"in",
"an",
"item_list",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Element/AccountHeaderElement.php#L61-L153 |
goalgorilla/open_social | modules/custom/activity_send/modules/activity_send_email/src/Plugin/QueueWorker/ActivityDigestWorker.php | ActivityDigestWorker.processItem | public function processItem($data) {
if (!empty($data['uid']) && !empty($data['frequency']) && !empty($data['activities'])) {
// Get target account.
$target = User::load($data['uid']);
// Make sure we have an actual user account to work with.
if ($target instanceof User && $target->isActive... | php | public function processItem($data) {
if (!empty($data['uid']) && !empty($data['frequency']) && !empty($data['activities'])) {
// Get target account.
$target = User::load($data['uid']);
// Make sure we have an actual user account to work with.
if ($target instanceof User && $target->isActive... | [
"public",
"function",
"processItem",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"data",
"[",
"'uid'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"data",
"[",
"'frequency'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"data",
"[",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_send/modules/activity_send_email/src/Plugin/QueueWorker/ActivityDigestWorker.php#L29-L96 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollSettingsForm.php | EventAnEnrollSettingsForm.buildForm | public function buildForm(array $form, FormStateInterface $form_state) {
$event_an_enroll_config = $this->config('social_event_an_enroll.settings');
$form['event_an_enroll'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enable event enrollment for anonymous users'),
'#description' => $this... | php | public function buildForm(array $form, FormStateInterface $form_state) {
$event_an_enroll_config = $this->config('social_event_an_enroll.settings');
$form['event_an_enroll'] = [
'#type' => 'checkbox',
'#title' => $this->t('Enable event enrollment for anonymous users'),
'#description' => $this... | [
"public",
"function",
"buildForm",
"(",
"array",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"event_an_enroll_config",
"=",
"$",
"this",
"->",
"config",
"(",
"'social_event_an_enroll.settings'",
")",
";",
"$",
"form",
"[",
"'event_a... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollSettingsForm.php#L32-L111 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollSettingsForm.php | EventAnEnrollSettingsForm.submitForm | public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('social_event_an_enroll.settings')
->set('event_an_enroll', $form_state->getValue('event_an_enroll'))
->set('event_an_enroll_default_value', $form_state->getValue('event_an_enroll_default_value'))
->set('event... | php | public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('social_event_an_enroll.settings')
->set('event_an_enroll', $form_state->getValue('event_an_enroll'))
->set('event_an_enroll_default_value', $form_state->getValue('event_an_enroll_default_value'))
->set('event... | [
"public",
"function",
"submitForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"this",
"->",
"config",
"(",
"'social_event_an_enroll.settings'",
")",
"->",
"set",
"(",
"'event_an_enroll'",
",",
"$",
"form_state",... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/Form/EventAnEnrollSettingsForm.php#L116-L127 |
goalgorilla/open_social | modules/social_features/social_group/modules/social_group_quickjoin/src/Controller/SocialQuickJoinController.php | SocialQuickJoinController.quickJoin | public function quickJoin(GroupInterface $group) {
// No group, so go home.
if (!$group instanceof GroupInterface) {
return new RedirectResponse(Url::fromRoute('<front>')->toString());
}
// It's a group, so determine the path for redirection.
$groupRedirect = $group->toUrl()->toString();
... | php | public function quickJoin(GroupInterface $group) {
// No group, so go home.
if (!$group instanceof GroupInterface) {
return new RedirectResponse(Url::fromRoute('<front>')->toString());
}
// It's a group, so determine the path for redirection.
$groupRedirect = $group->toUrl()->toString();
... | [
"public",
"function",
"quickJoin",
"(",
"GroupInterface",
"$",
"group",
")",
"{",
"// No group, so go home.",
"if",
"(",
"!",
"$",
"group",
"instanceof",
"GroupInterface",
")",
"{",
"return",
"new",
"RedirectResponse",
"(",
"Url",
"::",
"fromRoute",
"(",
"'<fron... | Function that add the current user to a group without confirmation step.
@param \Drupal\group\Entity\GroupInterface $group
The group you want to join.
@return \Symfony\Component\HttpFoundation\RedirectResponse
Where to redirect to.
@throws \Drupal\Core\Entity\EntityMalformedException | [
"Function",
"that",
"add",
"the",
"current",
"user",
"to",
"a",
"group",
"without",
"confirmation",
"step",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_quickjoin/src/Controller/SocialQuickJoinController.php#L73-L120 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_managers/src/SocialEventManagersConfigOverride.php | SocialEventManagersConfigOverride.loadOverrides | public function loadOverrides($names) {
$overrides = [];
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
$config = \Drupal::service('config.factory')->getEditable($config_name);
// Add a field group.
$field_group_settings = $config->get('... | php | public function loadOverrides($names) {
$overrides = [];
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
$config = \Drupal::service('config.factory')->getEditable($config_name);
// Add a field group.
$field_group_settings = $config->get('... | [
"public",
"function",
"loadOverrides",
"(",
"$",
"names",
")",
"{",
"$",
"overrides",
"=",
"[",
"]",
";",
"$",
"config_name",
"=",
"'core.entity_form_display.node.event.default'",
";",
"if",
"(",
"in_array",
"(",
"$",
"config_name",
",",
"$",
"names",
")",
"... | Load overrides. | [
"Load",
"overrides",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_managers/src/SocialEventManagersConfigOverride.php#L21-L67 |
goalgorilla/open_social | modules/social_features/social_core/src/Controller/SocialCoreController.php | SocialCoreController.accessDenied | public function accessDenied() {
// Get the front page URL.
$frontpage = $this->config('system.site')->get('page.front');
// Determine the message we want to set.
$text = $this->t("<p>You have insufficient permissions to view the page you're trying to access. There could be several reasons for this:</p... | php | public function accessDenied() {
// Get the front page URL.
$frontpage = $this->config('system.site')->get('page.front');
// Determine the message we want to set.
$text = $this->t("<p>You have insufficient permissions to view the page you're trying to access. There could be several reasons for this:</p... | [
"public",
"function",
"accessDenied",
"(",
")",
"{",
"// Get the front page URL.",
"$",
"frontpage",
"=",
"$",
"this",
"->",
"config",
"(",
"'system.site'",
")",
"->",
"get",
"(",
"'page.front'",
")",
";",
"// Determine the message we want to set.",
"$",
"text",
"... | Custom function for returning markup on the access denied page. | [
"Custom",
"function",
"for",
"returning",
"markup",
"on",
"the",
"access",
"denied",
"page",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/Controller/SocialCoreController.php#L15-L24 |
goalgorilla/open_social | modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php | UserAnalyticsPrivateMessage.getValue | public function getValue(UserInterface $entity) {
$value = '';
/** @var \Drupal\private_message\Entity\PrivateMessage $storage */
try {
$storage = $this->entityTypeManager->getStorage('private_message');
if (!empty($storage)) {
$query = $storage->getQuery();
$value = (int) $quer... | php | public function getValue(UserInterface $entity) {
$value = '';
/** @var \Drupal\private_message\Entity\PrivateMessage $storage */
try {
$storage = $this->entityTypeManager->getStorage('private_message');
if (!empty($storage)) {
$query = $storage->getQuery();
$value = (int) $quer... | [
"public",
"function",
"getValue",
"(",
"UserInterface",
"$",
"entity",
")",
"{",
"$",
"value",
"=",
"''",
";",
"/** @var \\Drupal\\private_message\\Entity\\PrivateMessage $storage */",
"try",
"{",
"$",
"storage",
"=",
"$",
"this",
"->",
"entityTypeManager",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php#L29-L45 |
goalgorilla/open_social | modules/social_features/social_user/src/Form/SocialUserSettingsForm.php | SocialUserSettingsForm.submitForm | public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->config('social_user.settings')
->set('social_user_profile_landingpage', $form_state->getValue('social_user_profile_landingpage'))
->save();
// Rebuild the router cache.
... | php | public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this->config('social_user.settings')
->set('social_user_profile_landingpage', $form_state->getValue('social_user_profile_landingpage'))
->save();
// Rebuild the router cache.
... | [
"public",
"function",
"submitForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"parent",
"::",
"submitForm",
"(",
"$",
"form",
",",
"$",
"form_state",
")",
";",
"$",
"this",
"->",
"config",
"(",
"'social_user.se... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserSettingsForm.php#L53-L65 |
goalgorilla/open_social | modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserLastLogin.php | UserLastLogin.getValue | public function getValue(UserInterface $entity) {
if ($last_login_time = $entity->getLastLoginTime()) {
$last_login = $this->dateFormatter->format($last_login_time, 'short');
}
else {
$last_login = t('never');
}
return $last_login;
} | php | public function getValue(UserInterface $entity) {
if ($last_login_time = $entity->getLastLoginTime()) {
$last_login = $this->dateFormatter->format($last_login_time, 'short');
}
else {
$last_login = t('never');
}
return $last_login;
} | [
"public",
"function",
"getValue",
"(",
"UserInterface",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"last_login_time",
"=",
"$",
"entity",
"->",
"getLastLoginTime",
"(",
")",
")",
"{",
"$",
"last_login",
"=",
"$",
"this",
"->",
"dateFormatter",
"->",
"format"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserLastLogin.php#L29-L37 |
goalgorilla/open_social | modules/social_features/social_comment/src/SocialCommentBreadcrumbBuilder.php | SocialCommentBreadcrumbBuilder.build | public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$breadcrumb->addCacheContexts(['route']);
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
switch ($route_matc... | php | public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$breadcrumb->addCacheContexts(['route']);
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
switch ($route_matc... | [
"public",
"function",
"build",
"(",
"RouteMatchInterface",
"$",
"route_match",
")",
"{",
"$",
"breadcrumb",
"=",
"new",
"Breadcrumb",
"(",
")",
";",
"$",
"breadcrumb",
"->",
"addCacheContexts",
"(",
"[",
"'route'",
"]",
")",
";",
"$",
"breadcrumb",
"->",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/SocialCommentBreadcrumbBuilder.php#L51-L94 |
goalgorilla/open_social | modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php | SocialTagsBlock.blockAccess | protected function blockAccess(AccountInterface $account) {
// If tagging is off, deny access always.
if (!$this->tagService->active()) {
return AccessResult::forbidden();
}
$route_name = $this->routeMatch->getRouteName();
if ($route_name == 'entity.node.canonical') {
$node = $this->ro... | php | protected function blockAccess(AccountInterface $account) {
// If tagging is off, deny access always.
if (!$this->tagService->active()) {
return AccessResult::forbidden();
}
$route_name = $this->routeMatch->getRouteName();
if ($route_name == 'entity.node.canonical') {
$node = $this->ro... | [
"protected",
"function",
"blockAccess",
"(",
"AccountInterface",
"$",
"account",
")",
"{",
"// If tagging is off, deny access always.",
"if",
"(",
"!",
"$",
"this",
"->",
"tagService",
"->",
"active",
"(",
")",
")",
"{",
"return",
"AccessResult",
"::",
"forbidden"... | {@inheritdoc}
Logic to display the block in the sidebar. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php#L77-L99 |
goalgorilla/open_social | modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php | SocialTagsBlock.getCacheTags | public function getCacheTags() {
$cache_tags = parent::getCacheTags();
$node = $this->routeMatch->getParameter('node');
if ($node instanceof Node) {
$cache_tags[] = 'node:' . $node->id();
}
return $cache_tags;
} | php | public function getCacheTags() {
$cache_tags = parent::getCacheTags();
$node = $this->routeMatch->getParameter('node');
if ($node instanceof Node) {
$cache_tags[] = 'node:' . $node->id();
}
return $cache_tags;
} | [
"public",
"function",
"getCacheTags",
"(",
")",
"{",
"$",
"cache_tags",
"=",
"parent",
"::",
"getCacheTags",
"(",
")",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"routeMatch",
"->",
"getParameter",
"(",
"'node'",
")",
";",
"if",
"(",
"$",
"node",
"insta... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php#L113-L122 |
goalgorilla/open_social | modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php | SocialTagsBlock.build | public function build() {
$build = [];
$node = $this->routeMatch->getParameter('node');
if ($node instanceof NodeInterface) {
$build['content']['#markup'] = social_tagging_process_tags($node);
}
return $build;
} | php | public function build() {
$build = [];
$node = $this->routeMatch->getParameter('node');
if ($node instanceof NodeInterface) {
$build['content']['#markup'] = social_tagging_process_tags($node);
}
return $build;
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"build",
"=",
"[",
"]",
";",
"$",
"node",
"=",
"$",
"this",
"->",
"routeMatch",
"->",
"getParameter",
"(",
"'node'",
")",
";",
"if",
"(",
"$",
"node",
"instanceof",
"NodeInterface",
")",
"{",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/Plugin/Block/SocialTagsBlock.php#L127-L137 |
goalgorilla/open_social | modules/custom/social_font/src/FontHtmlRouteProvider.php | FontHtmlRouteProvider.getCollectionRoute | protected function getCollectionRoute(EntityTypeInterface $entity_type) {
if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) {
$entity_type_id = $entity_type->id();
$route = new Route($entity_type->getLinkTemplate('collection'));
$route
->setDefaults([
... | php | protected function getCollectionRoute(EntityTypeInterface $entity_type) {
if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) {
$entity_type_id = $entity_type->id();
$route = new Route($entity_type->getLinkTemplate('collection'));
$route
->setDefaults([
... | [
"protected",
"function",
"getCollectionRoute",
"(",
"EntityTypeInterface",
"$",
"entity_type",
")",
"{",
"if",
"(",
"$",
"entity_type",
"->",
"hasLinkTemplate",
"(",
"'collection'",
")",
"&&",
"$",
"entity_type",
"->",
"hasListBuilderClass",
"(",
")",
")",
"{",
... | Gets the collection route.
@param \Drupal\Core\Entity\EntityTypeInterface $entity_type
The entity type.
@return \Symfony\Component\Routing\Route|null
The generated route, if available. | [
"Gets",
"the",
"collection",
"route",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_font/src/FontHtmlRouteProvider.php#L45-L59 |
goalgorilla/open_social | modules/custom/social_font/src/FontHtmlRouteProvider.php | FontHtmlRouteProvider.getSettingsFormRoute | protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
if (!$entity_type->getBundleEntityType()) {
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
$route
->setDefaults([
'_form' => 'Drupal\social_font\Form\FontSettingsForm',
'_title'... | php | protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
if (!$entity_type->getBundleEntityType()) {
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
$route
->setDefaults([
'_form' => 'Drupal\social_font\Form\FontSettingsForm',
'_title'... | [
"protected",
"function",
"getSettingsFormRoute",
"(",
"EntityTypeInterface",
"$",
"entity_type",
")",
"{",
"if",
"(",
"!",
"$",
"entity_type",
"->",
"getBundleEntityType",
"(",
")",
")",
"{",
"$",
"route",
"=",
"new",
"Route",
"(",
"\"/admin/structure/{$entity_typ... | Gets the settings form route.
@param \Drupal\Core\Entity\EntityTypeInterface $entity_type
The entity type.
@return \Symfony\Component\Routing\Route|null
The generated route, if available. | [
"Gets",
"the",
"settings",
"form",
"route",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_font/src/FontHtmlRouteProvider.php#L70-L83 |
goalgorilla/open_social | modules/social_features/social_embed/src/Plugin/Filter/SocialEmbedUrlFilter.php | SocialEmbedUrlFilter.process | public function process($text, $langcode) {
// Check for whitelisted URL.
if ($this->whiteList($text)) {
return parent::process($text, $langcode);
}
// Not whitelisted is return the string as is.
return new FilterProcessResult($text);
} | php | public function process($text, $langcode) {
// Check for whitelisted URL.
if ($this->whiteList($text)) {
return parent::process($text, $langcode);
}
// Not whitelisted is return the string as is.
return new FilterProcessResult($text);
} | [
"public",
"function",
"process",
"(",
"$",
"text",
",",
"$",
"langcode",
")",
"{",
"// Check for whitelisted URL.",
"if",
"(",
"$",
"this",
"->",
"whiteList",
"(",
"$",
"text",
")",
")",
"{",
"return",
"parent",
"::",
"process",
"(",
"$",
"text",
",",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_embed/src/Plugin/Filter/SocialEmbedUrlFilter.php#L34-L41 |
goalgorilla/open_social | modules/social_features/social_embed/src/Plugin/Filter/SocialEmbedUrlFilter.php | SocialEmbedUrlFilter.whiteList | public function whiteList($text) {
// Fetch allowed patterns.
$patterns = $this->getPatterns();
// Check if the URL provided is from a whitelisted site.
foreach ($patterns as $pattern) {
// Testing pattern.
$testing_pattern = '/' . $pattern . '/';
// Check if it matches.
if (pre... | php | public function whiteList($text) {
// Fetch allowed patterns.
$patterns = $this->getPatterns();
// Check if the URL provided is from a whitelisted site.
foreach ($patterns as $pattern) {
// Testing pattern.
$testing_pattern = '/' . $pattern . '/';
// Check if it matches.
if (pre... | [
"public",
"function",
"whiteList",
"(",
"$",
"text",
")",
"{",
"// Fetch allowed patterns.",
"$",
"patterns",
"=",
"$",
"this",
"->",
"getPatterns",
"(",
")",
";",
"// Check if the URL provided is from a whitelisted site.",
"foreach",
"(",
"$",
"patterns",
"as",
"$"... | Checks if item is on the whitelist.
@param string $text
The item to check for.
@return bool
Return if the item is on the whitelist or not. | [
"Checks",
"if",
"item",
"is",
"on",
"the",
"whitelist",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_embed/src/Plugin/Filter/SocialEmbedUrlFilter.php#L52-L66 |
goalgorilla/open_social | modules/custom/social_tour/src/SocialTourController.php | SocialTourController.onboardingEnabled | public function onboardingEnabled() {
// Check if tour is enabled by SM setting.
if ($this->configFactory->get('social_tour_enabled') == FALSE) {
return FALSE;
}
// Check permissions.
if (!$this->currentUser->hasPermission('access tour')) {
return FALSE;
}
// Check if current d... | php | public function onboardingEnabled() {
// Check if tour is enabled by SM setting.
if ($this->configFactory->get('social_tour_enabled') == FALSE) {
return FALSE;
}
// Check permissions.
if (!$this->currentUser->hasPermission('access tour')) {
return FALSE;
}
// Check if current d... | [
"public",
"function",
"onboardingEnabled",
"(",
")",
"{",
"// Check if tour is enabled by SM setting.",
"if",
"(",
"$",
"this",
"->",
"configFactory",
"->",
"get",
"(",
"'social_tour_enabled'",
")",
"==",
"FALSE",
")",
"{",
"return",
"FALSE",
";",
"}",
"// Check p... | Check if onboarding is enabled.
@return bool
Returns either TRUE or FALSE. | [
"Check",
"if",
"onboarding",
"is",
"enabled",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_tour/src/SocialTourController.php#L71-L87 |
goalgorilla/open_social | modules/custom/social_tour/src/SocialTourController.php | SocialTourController.toggleOnboarding | public function toggleOnboarding(array $account = NULL) {
// No user given, then current user.
$id = $this->currentUser->id();
if ($account instanceof User) {
$id = $account->id();
}
$new_value = TRUE;
if ($this->userData->get('social_tour', $id, 'onboarding_disabled') == TRUE) {
$... | php | public function toggleOnboarding(array $account = NULL) {
// No user given, then current user.
$id = $this->currentUser->id();
if ($account instanceof User) {
$id = $account->id();
}
$new_value = TRUE;
if ($this->userData->get('social_tour', $id, 'onboarding_disabled') == TRUE) {
$... | [
"public",
"function",
"toggleOnboarding",
"(",
"array",
"$",
"account",
"=",
"NULL",
")",
"{",
"// No user given, then current user.",
"$",
"id",
"=",
"$",
"this",
"->",
"currentUser",
"->",
"id",
"(",
")",
";",
"if",
"(",
"$",
"account",
"instanceof",
"User... | Toggle onboarding.
@param array $account
Array containing the account. | [
"Toggle",
"onboarding",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_tour/src/SocialTourController.php#L95-L110 |
goalgorilla/open_social | modules/custom/social_tour/src/SocialTourController.php | SocialTourController.disableOnboarding | public function disableOnboarding() {
// Save the value in the user_data.
$this->setData(TRUE);
$redirect = \Drupal::request()->get('destination') ?: '/stream';
// Set a message that they can be turned on again.
drupal_set_message($this->t('You will not see tips like this anymore.'));
// Return ... | php | public function disableOnboarding() {
// Save the value in the user_data.
$this->setData(TRUE);
$redirect = \Drupal::request()->get('destination') ?: '/stream';
// Set a message that they can be turned on again.
drupal_set_message($this->t('You will not see tips like this anymore.'));
// Return ... | [
"public",
"function",
"disableOnboarding",
"(",
")",
"{",
"// Save the value in the user_data.",
"$",
"this",
"->",
"setData",
"(",
"TRUE",
")",
";",
"$",
"redirect",
"=",
"\\",
"Drupal",
"::",
"request",
"(",
")",
"->",
"get",
"(",
"'destination'",
")",
"?"... | Disable onboarding for current_user by Ajax call. | [
"Disable",
"onboarding",
"for",
"current_user",
"by",
"Ajax",
"call",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_tour/src/SocialTourController.php#L125-L133 |
goalgorilla/open_social | modules/custom/social_tour/src/SocialTourController.php | SocialTourController.setData | private function setData($disabled = TRUE) {
$this->userData->set('social_tour', $this->currentUser->id(), 'onboarding_disabled', $disabled);
} | php | private function setData($disabled = TRUE) {
$this->userData->set('social_tour', $this->currentUser->id(), 'onboarding_disabled', $disabled);
} | [
"private",
"function",
"setData",
"(",
"$",
"disabled",
"=",
"TRUE",
")",
"{",
"$",
"this",
"->",
"userData",
"->",
"set",
"(",
"'social_tour'",
",",
"$",
"this",
"->",
"currentUser",
"->",
"id",
"(",
")",
",",
"'onboarding_disabled'",
",",
"$",
"disable... | Set onboarding data value.
@param bool $disabled
Type of bool, either TRUE or FALSE. | [
"Set",
"onboarding",
"data",
"value",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_tour/src/SocialTourController.php#L141-L143 |
goalgorilla/open_social | modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php | ActivityOverviewBlock.build | public function build() {
return [
[
'#type' => 'container',
'#attributes' => [
'class' => ['activity-overview'],
],
'event_info' => [
'#type' => 'container',
'#attributes' => [
'class' => ['event-info'],
],
'event' ... | php | public function build() {
return [
[
'#type' => 'container',
'#attributes' => [
'class' => ['activity-overview'],
],
'event_info' => [
'#type' => 'container',
'#attributes' => [
'class' => ['event-info'],
],
'event' ... | [
"public",
"function",
"build",
"(",
")",
"{",
"return",
"[",
"[",
"'#type'",
"=>",
"'container'",
",",
"'#attributes'",
"=>",
"[",
"'class'",
"=>",
"[",
"'activity-overview'",
"]",
",",
"]",
",",
"'event_info'",
"=>",
"[",
"'#type'",
"=>",
"'container'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php#L55-L277 |
goalgorilla/open_social | modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php | ActivityOverviewBlock.getEventsCount | protected function getEventsCount() {
$query = $this->connection->select('node_field_data', 'n');
$query->addExpression('COUNT(*)');
$query->condition('n.type', 'event');
$query->condition('n.status', 1);
return $query->execute()->fetchField();
} | php | protected function getEventsCount() {
$query = $this->connection->select('node_field_data', 'n');
$query->addExpression('COUNT(*)');
$query->condition('n.type', 'event');
$query->condition('n.status', 1);
return $query->execute()->fetchField();
} | [
"protected",
"function",
"getEventsCount",
"(",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"'node_field_data'",
",",
"'n'",
")",
";",
"$",
"query",
"->",
"addExpression",
"(",
"'COUNT(*)'",
")",
";",
"$",
"query",
... | Get total count of events. | [
"Get",
"total",
"count",
"of",
"events",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php#L282-L288 |
goalgorilla/open_social | modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php | ActivityOverviewBlock.getGroupsCount | protected function getGroupsCount() {
// There is no unpublished option for groups.
$query = $this->connection->select('groups', 'g');
$query->addExpression('COUNT(*)');
return $query->execute()->fetchField();
} | php | protected function getGroupsCount() {
// There is no unpublished option for groups.
$query = $this->connection->select('groups', 'g');
$query->addExpression('COUNT(*)');
return $query->execute()->fetchField();
} | [
"protected",
"function",
"getGroupsCount",
"(",
")",
"{",
"// There is no unpublished option for groups.",
"$",
"query",
"=",
"$",
"this",
"->",
"connection",
"->",
"select",
"(",
"'groups'",
",",
"'g'",
")",
";",
"$",
"query",
"->",
"addExpression",
"(",
"'COUN... | Get total count of groups. | [
"Get",
"total",
"count",
"of",
"groups",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/Plugin/Block/ActivityOverviewBlock.php#L304-L309 |
goalgorilla/open_social | modules/custom/activity_basics/src/Plugin/ActivityContext/OrganizerActivityContext.php | OrganizerActivityContext.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_entity = ActivityFactory::getActivityRelatedEntity($data);
if ($data['rel... | 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_entity = ActivityFactory::getActivityRelatedEntity($data);
if ($data['rel... | [
"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/OrganizerActivityContext.php#L21-L33 |
goalgorilla/open_social | modules/custom/activity_basics/src/Plugin/ActivityContext/OrganizerActivityContext.php | OrganizerActivityContext.getRecipientOrganizerFromEntity | public function getRecipientOrganizerFromEntity(array $related_entity, array $data) {
$recipients = [];
// Don't return recipients if user comments on own content.
$original_related_object = $data['related_object'][0];
if (isset($original_related_object['target_type'])
&& $original_related_object... | php | public function getRecipientOrganizerFromEntity(array $related_entity, array $data) {
$recipients = [];
// Don't return recipients if user comments on own content.
$original_related_object = $data['related_object'][0];
if (isset($original_related_object['target_type'])
&& $original_related_object... | [
"public",
"function",
"getRecipientOrganizerFromEntity",
"(",
"array",
"$",
"related_entity",
",",
"array",
"$",
"data",
")",
"{",
"$",
"recipients",
"=",
"[",
"]",
";",
"// Don't return recipients if user comments on own content.",
"$",
"original_related_object",
"=",
... | Returns Organizer recipient from Events. | [
"Returns",
"Organizer",
"recipient",
"from",
"Events",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_basics/src/Plugin/ActivityContext/OrganizerActivityContext.php#L38-L65 |
goalgorilla/open_social | modules/custom/social_auth_google/src/Plugin/Network/GoogleAuth.php | GoogleAuth.initSdk | public function initSdk() {
$class_name = '\Google_Client';
if (!class_exists($class_name)) {
throw new SocialApiException(sprintf('The PHP SDK for Google Services could not be found. Class: %s.', $class_name));
}
if (!$this->validateConfig($this->settings)) {
return FALSE;
}
$cli... | php | public function initSdk() {
$class_name = '\Google_Client';
if (!class_exists($class_name)) {
throw new SocialApiException(sprintf('The PHP SDK for Google Services could not be found. Class: %s.', $class_name));
}
if (!$this->validateConfig($this->settings)) {
return FALSE;
}
$cli... | [
"public",
"function",
"initSdk",
"(",
")",
"{",
"$",
"class_name",
"=",
"'\\Google_Client'",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class_name",
")",
")",
"{",
"throw",
"new",
"SocialApiException",
"(",
"sprintf",
"(",
"'The PHP SDK for Google Services ... | Returns an instance of sdk.
@return mixed
Returns a new Google Client 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_google/src/Plugin/Network/GoogleAuth.php#L37-L53 |
goalgorilla/open_social | modules/social_features/social_book/src/Plugin/Block/GroupAddBookBlock.php | GroupAddBookBlock.blockAccess | public function blockAccess(AccountInterface $account) {
if (\Drupal::moduleHandler()->moduleExists('social_group')) {
$group = _social_group_get_current_group();
}
else {
$group = NULL;
}
if (is_object($group)) {
if ($group->hasPermission('create group_node:book entity', $account... | php | public function blockAccess(AccountInterface $account) {
if (\Drupal::moduleHandler()->moduleExists('social_group')) {
$group = _social_group_get_current_group();
}
else {
$group = NULL;
}
if (is_object($group)) {
if ($group->hasPermission('create group_node:book entity', $account... | [
"public",
"function",
"blockAccess",
"(",
"AccountInterface",
"$",
"account",
")",
"{",
"if",
"(",
"\\",
"Drupal",
"::",
"moduleHandler",
"(",
")",
"->",
"moduleExists",
"(",
"'social_group'",
")",
")",
"{",
"$",
"group",
"=",
"_social_group_get_current_group",
... | {@inheritdoc}
Custom access logic to display the block. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_book/src/Plugin/Block/GroupAddBookBlock.php#L33-L55 |
goalgorilla/open_social | modules/social_features/social_book/src/Plugin/Block/GroupAddBookBlock.php | GroupAddBookBlock.build | public function build() {
$build = [];
if (\Drupal::moduleHandler()->moduleExists('social_group')) {
$group = _social_group_get_current_group();
}
else {
$group = NULL;
}
if (is_object($group)) {
$url = Url::fromUserInput("/group/{$group->id()}/content/create/group_node:book"... | php | public function build() {
$build = [];
if (\Drupal::moduleHandler()->moduleExists('social_group')) {
$group = _social_group_get_current_group();
}
else {
$group = NULL;
}
if (is_object($group)) {
$url = Url::fromUserInput("/group/{$group->id()}/content/create/group_node:book"... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"build",
"=",
"[",
"]",
";",
"if",
"(",
"\\",
"Drupal",
"::",
"moduleHandler",
"(",
")",
"->",
"moduleExists",
"(",
"'social_group'",
")",
")",
"{",
"$",
"group",
"=",
"_social_group_get_current_group",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_book/src/Plugin/Block/GroupAddBookBlock.php#L60-L94 |
goalgorilla/open_social | modules/social_features/social_group/src/Plugin/views/field/SocialGroupViewsBulkOperationsBulkForm.php | SocialGroupViewsBulkOperationsBulkForm.viewsForm | public function viewsForm(array &$form, FormStateInterface $form_state) {
$this->view->setExposedInput(['status' => TRUE]);
parent::viewsForm($form, $form_state);
if ($this->view->id() !== 'group_manage_members') {
return;
}
// Get pager data if available.
if (!empty($this->view->pager)... | php | public function viewsForm(array &$form, FormStateInterface $form_state) {
$this->view->setExposedInput(['status' => TRUE]);
parent::viewsForm($form, $form_state);
if ($this->view->id() !== 'group_manage_members') {
return;
}
// Get pager data if available.
if (!empty($this->view->pager)... | [
"public",
"function",
"viewsForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"setExposedInput",
"(",
"[",
"'status'",
"=>",
"TRUE",
"]",
")",
";",
"parent",
"::",
"viewsForm",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/views/field/SocialGroupViewsBulkOperationsBulkForm.php#L62-L153 |
goalgorilla/open_social | modules/social_features/social_group/src/Plugin/views/field/SocialGroupViewsBulkOperationsBulkForm.php | SocialGroupViewsBulkOperationsBulkForm.viewsFormSubmit | public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
parent::viewsFormSubmit($form, $form_state);
if ($form_state->get('step') === 'views_form_views_form' && $this->view->id() === 'group_manage_members') {
/** @var \Drupal\Core\Url $url */
$url = $form_state->getRedirect(... | php | public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
parent::viewsFormSubmit($form, $form_state);
if ($form_state->get('step') === 'views_form_views_form' && $this->view->id() === 'group_manage_members') {
/** @var \Drupal\Core\Url $url */
$url = $form_state->getRedirect(... | [
"public",
"function",
"viewsFormSubmit",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"parent",
"::",
"viewsFormSubmit",
"(",
"$",
"form",
",",
"$",
"form_state",
")",
";",
"if",
"(",
"$",
"form_state",
"->",
"get... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/views/field/SocialGroupViewsBulkOperationsBulkForm.php#L179-L196 |
goalgorilla/open_social | modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php | SocialAdminMenuAdministratorMenuLinkTreeManipulators.checkAccess | public function checkAccess(array $tree) {
if ($this->account->id() != 1) {
$account_roles = $this->account->getRoles();
// Define routes to hide for a role.
// 'content' => 'system.admin_content',
// 'structure' => 'system.admin_structure',
// 'config' => 'system.admin_config',
... | php | public function checkAccess(array $tree) {
if ($this->account->id() != 1) {
$account_roles = $this->account->getRoles();
// Define routes to hide for a role.
// 'content' => 'system.admin_content',
// 'structure' => 'system.admin_structure',
// 'config' => 'system.admin_config',
... | [
"public",
"function",
"checkAccess",
"(",
"array",
"$",
"tree",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"account",
"->",
"id",
"(",
")",
"!=",
"1",
")",
"{",
"$",
"account_roles",
"=",
"$",
"this",
"->",
"account",
"->",
"getRoles",
"(",
")",
";",
... | Performs access checks of a menu tree.
Sets the 'access' property to AccessResultInterface objects on menu link
tree elements. Descends into subtrees if the root of the subtree is
accessible. Inaccessible subtrees are deleted, except the top-level
inaccessible link, to be compatible with render caching.
(This means t... | [
"Performs",
"access",
"checks",
"of",
"a",
"menu",
"tree",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php#L47-L99 |
goalgorilla/open_social | modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php | SocialAdminMenuAdministratorMenuLinkTreeManipulators.renderForm | public function renderForm() {
$menu_tree = \Drupal::service('toolbar.menu_tree');
$parameters = new MenuTreeParameters();
$parameters->setRoot('system.admin')->excludeRoot()->setMaxDepth(4)->onlyEnabledLinks();
$manipulators = [
['callable' => 'menu.default_tree_manipulators:checkAccess'],
... | php | public function renderForm() {
$menu_tree = \Drupal::service('toolbar.menu_tree');
$parameters = new MenuTreeParameters();
$parameters->setRoot('system.admin')->excludeRoot()->setMaxDepth(4)->onlyEnabledLinks();
$manipulators = [
['callable' => 'menu.default_tree_manipulators:checkAccess'],
... | [
"public",
"function",
"renderForm",
"(",
")",
"{",
"$",
"menu_tree",
"=",
"\\",
"Drupal",
"::",
"service",
"(",
"'toolbar.menu_tree'",
")",
";",
"$",
"parameters",
"=",
"new",
"MenuTreeParameters",
"(",
")",
";",
"$",
"parameters",
"->",
"setRoot",
"(",
"'... | Renders the toolbar's administration tray.
This is a adoption of core's
toolbar_prerender_toolbar_administration_tray() function,
which uses setMaxDepth(4) instead of setTopLevelOnly()
@return array
The updated renderable array.
@see admin_toolbar_prerender_toolbar_administration_tray() | [
"Renders",
"the",
"toolbar",
"s",
"administration",
"tray",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php#L113-L128 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/Page.php | Page.preprocess | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// Add needed attributes so later in template we can manipulate with them.
$attributes = new Attribute();
// Default classes.
$attributes->addClass('row', 'container');
// If page h... | php | public function preprocess(array &$variables, $hook, array $info) {
parent::preprocess($variables, $hook, $info);
// Add needed attributes so later in template we can manipulate with them.
$attributes = new Attribute();
// Default classes.
$attributes->addClass('row', 'container');
// If page h... | [
"public",
"function",
"preprocess",
"(",
"array",
"&",
"$",
"variables",
",",
"$",
"hook",
",",
"array",
"$",
"info",
")",
"{",
"parent",
"::",
"preprocess",
"(",
"$",
"variables",
",",
"$",
"hook",
",",
"$",
"info",
")",
";",
"// Add needed attributes s... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Page.php#L22-L117 |
goalgorilla/open_social | modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php | MentionActivityContext.getRecipients | public function getRecipients(array $data, $last_uid, $limit) {
$recipients = [];
$mentions = [];
// 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];
$mentions_storag... | php | public function getRecipients(array $data, $last_uid, $limit) {
$recipients = [];
$mentions = [];
// 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];
$mentions_storag... | [
"public",
"function",
"getRecipients",
"(",
"array",
"$",
"data",
",",
"$",
"last_uid",
",",
"$",
"limit",
")",
"{",
"$",
"recipients",
"=",
"[",
"]",
";",
"$",
"mentions",
"=",
"[",
"]",
";",
"// We only know the context if there is a related object.",
"if",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php#L21-L70 |
goalgorilla/open_social | modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php | MentionActivityContext.isValidEntity | public function isValidEntity($entity) {
if ($entity->getEntityTypeId() === 'mentions') {
return TRUE;
}
// Special cases for comments and posts.
$allowed_content_types = [
'comment',
];
if (in_array($entity->getEntityTypeId(), $allowed_content_types)) {
$mentions = $this->get... | php | public function isValidEntity($entity) {
if ($entity->getEntityTypeId() === 'mentions') {
return TRUE;
}
// Special cases for comments and posts.
$allowed_content_types = [
'comment',
];
if (in_array($entity->getEntityTypeId(), $allowed_content_types)) {
$mentions = $this->get... | [
"public",
"function",
"isValidEntity",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"getEntityTypeId",
"(",
")",
"===",
"'mentions'",
")",
"{",
"return",
"TRUE",
";",
"}",
"// Special cases for comments and posts.",
"$",
"allowed_content_types",
... | Check for valid entity. | [
"Check",
"for",
"valid",
"entity",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php#L75-L91 |
goalgorilla/open_social | modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php | MentionActivityContext.getMentionsFromRelatedEntity | public function getMentionsFromRelatedEntity($entity) {
if ($entity->getEntityTypeId() === 'comment') {
if ($entity->getParentComment()) {
$entity = $entity->getParentComment();
}
}
// Mention entity can't be loaded at time of new post or comment creation.
$mentions = \Drupal::entity... | php | public function getMentionsFromRelatedEntity($entity) {
if ($entity->getEntityTypeId() === 'comment') {
if ($entity->getParentComment()) {
$entity = $entity->getParentComment();
}
}
// Mention entity can't be loaded at time of new post or comment creation.
$mentions = \Drupal::entity... | [
"public",
"function",
"getMentionsFromRelatedEntity",
"(",
"$",
"entity",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"getEntityTypeId",
"(",
")",
"===",
"'comment'",
")",
"{",
"if",
"(",
"$",
"entity",
"->",
"getParentComment",
"(",
")",
")",
"{",
"$",
"e... | Get the mentions from the related entity. | [
"Get",
"the",
"mentions",
"from",
"the",
"related",
"entity",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_mentions/src/Plugin/ActivityContext/MentionActivityContext.php#L96-L110 |
goalgorilla/open_social | modules/custom/social_auth_twitter/src/Plugin/Network/TwitterAuth.php | TwitterAuth.initSdk | public function initSdk() {
$class_name = '\Abraham\TwitterOAuth\TwitterOAuth';
if (!class_exists($class_name)) {
throw new SocialApiException(sprintf('The PHP SDK for Twitter Client could not be found. Class: %s.', $class_name));
}
/* @var \Drupal\social_auth_twitter\Settings\TwitterAuthSetting... | php | public function initSdk() {
$class_name = '\Abraham\TwitterOAuth\TwitterOAuth';
if (!class_exists($class_name)) {
throw new SocialApiException(sprintf('The PHP SDK for Twitter Client could not be found. Class: %s.', $class_name));
}
/* @var \Drupal\social_auth_twitter\Settings\TwitterAuthSetting... | [
"public",
"function",
"initSdk",
"(",
")",
"{",
"$",
"class_name",
"=",
"'\\Abraham\\TwitterOAuth\\TwitterOAuth'",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class_name",
")",
")",
"{",
"throw",
"new",
"SocialApiException",
"(",
"sprintf",
"(",
"'The PHP SD... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_twitter/src/Plugin/Network/TwitterAuth.php#L58-L74 |
goalgorilla/open_social | modules/custom/social_auth_twitter/src/Plugin/Network/TwitterAuth.php | TwitterAuth.validateConfig | protected function validateConfig(TwitterAuthSettings $settings) {
$consumer_key = $settings->getConsumerKey();
$consumer_secret = $settings->getConsumerSecret();
if (!$consumer_key || !$consumer_secret) {
$this->loggerFactory
->get('social_auth_twitter')
->error('Define Consumer Key ... | php | protected function validateConfig(TwitterAuthSettings $settings) {
$consumer_key = $settings->getConsumerKey();
$consumer_secret = $settings->getConsumerSecret();
if (!$consumer_key || !$consumer_secret) {
$this->loggerFactory
->get('social_auth_twitter')
->error('Define Consumer Key ... | [
"protected",
"function",
"validateConfig",
"(",
"TwitterAuthSettings",
"$",
"settings",
")",
"{",
"$",
"consumer_key",
"=",
"$",
"settings",
"->",
"getConsumerKey",
"(",
")",
";",
"$",
"consumer_secret",
"=",
"$",
"settings",
"->",
"getConsumerSecret",
"(",
")",... | Checks that module is configured.
@param \Drupal\social_auth_twitter\Settings\TwitterAuthSettings $settings
The Twitter 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_twitter/src/Plugin/Network/TwitterAuth.php#L95-L108 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php | EventMaxEnrollOverride.loadOverrides | public function loadOverrides($names) {
$overrides = [];
// Add field_event_max_enroll to event form.
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
if ($this->socialEventAnEnrollOverrider instanceof ConfigFactoryOverrideInterface) {
$p... | php | public function loadOverrides($names) {
$overrides = [];
// Add field_event_max_enroll to event form.
$config_name = 'core.entity_form_display.node.event.default';
if (in_array($config_name, $names)) {
if ($this->socialEventAnEnrollOverrider instanceof ConfigFactoryOverrideInterface) {
$p... | [
"public",
"function",
"loadOverrides",
"(",
"$",
"names",
")",
"{",
"$",
"overrides",
"=",
"[",
"]",
";",
"// Add field_event_max_enroll to event form.",
"$",
"config_name",
"=",
"'core.entity_form_display.node.event.default'",
";",
"if",
"(",
"in_array",
"(",
"$",
... | Returns config overrides. | [
"Returns",
"config",
"overrides",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_max_enroll/src/EventMaxEnrollOverride.php#L53-L111 |
goalgorilla/open_social | modules/social_features/social_landing_page/src/Plugin/Field/FieldFormatter/BlockIdFormatter.php | BlockIdFormatter.viewElements | public function viewElements(FieldItemListInterface $items, $langcode) {
$elements = [];
foreach ($items as $delta => $item) {
/** @var \Drupal\block_field\BlockFieldItemInterface $item */
$block_instance = $item->getBlock();
// Make sure the block exists and is accessible.
if (!$block_i... | php | public function viewElements(FieldItemListInterface $items, $langcode) {
$elements = [];
foreach ($items as $delta => $item) {
/** @var \Drupal\block_field\BlockFieldItemInterface $item */
$block_instance = $item->getBlock();
// Make sure the block exists and is accessible.
if (!$block_i... | [
"public",
"function",
"viewElements",
"(",
"FieldItemListInterface",
"$",
"items",
",",
"$",
"langcode",
")",
"{",
"$",
"elements",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"delta",
"=>",
"$",
"item",
")",
"{",
"/** @var \\Drupal\\block... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/Plugin/Field/FieldFormatter/BlockIdFormatter.php#L92-L108 |
goalgorilla/open_social | modules/social_features/social_book/src/SocialBookConfigOverride.php | SocialBookConfigOverride.loadOverrides | public function loadOverrides($names) {
$overrides = [];
// Set hero title block for book content type.
$config_names = [
'block.block.socialbase_pagetitleblock',
'block.block.socialblue_pagetitleblock',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names... | php | public function loadOverrides($names) {
$overrides = [];
// Set hero title block for book content type.
$config_names = [
'block.block.socialbase_pagetitleblock',
'block.block.socialblue_pagetitleblock',
];
foreach ($config_names as $config_name) {
if (in_array($config_name, $names... | [
"public",
"function",
"loadOverrides",
"(",
"$",
"names",
")",
"{",
"$",
"overrides",
"=",
"[",
"]",
";",
"// Set hero title block for book content type.",
"$",
"config_names",
"=",
"[",
"'block.block.socialbase_pagetitleblock'",
",",
"'block.block.socialblue_pagetitleblock... | Load overrides. | [
"Load",
"overrides",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_book/src/SocialBookConfigOverride.php#L20-L36 |
goalgorilla/open_social | modules/social_features/social_private_message/src/SocialPrivateMessageServiceProvider.php | SocialPrivateMessageServiceProvider.alter | public function alter(ContainerBuilder $container) {
$definition = $container->getDefinition('private_message.mailer');
$definition->setClass('Drupal\social_private_message\Service\PrivateMessageMailer');
$definition = $container->getDefinition('private_message.mapper');
$definition->setClass('Drupal\s... | php | public function alter(ContainerBuilder $container) {
$definition = $container->getDefinition('private_message.mailer');
$definition->setClass('Drupal\social_private_message\Service\PrivateMessageMailer');
$definition = $container->getDefinition('private_message.mapper');
$definition->setClass('Drupal\s... | [
"public",
"function",
"alter",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
"(",
"'private_message.mailer'",
")",
";",
"$",
"definition",
"->",
"setClass",
"(",
"'Drupal\\social_private_message... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/SocialPrivateMessageServiceProvider.php#L18-L24 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/DropdownActions.php | DropdownActions.preprocessLinks | protected function preprocessLinks(Variables $variables) {
parent::preprocessLinks($variables);
$variables['btn_context'] = 'actions';
$variables->toggle['#split_button_attributes']['class'][] = 'pull-right';
unset($variables->toggle['#attributes']['class']);
} | php | protected function preprocessLinks(Variables $variables) {
parent::preprocessLinks($variables);
$variables['btn_context'] = 'actions';
$variables->toggle['#split_button_attributes']['class'][] = 'pull-right';
unset($variables->toggle['#attributes']['class']);
} | [
"protected",
"function",
"preprocessLinks",
"(",
"Variables",
"$",
"variables",
")",
"{",
"parent",
"::",
"preprocessLinks",
"(",
"$",
"variables",
")",
";",
"$",
"variables",
"[",
"'btn_context'",
"]",
"=",
"'actions'",
";",
"$",
"variables",
"->",
"toggle",
... | Function to preprocess the links. | [
"Function",
"to",
"preprocess",
"the",
"links",
"."
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/DropdownActions.php#L19-L26 |
goalgorilla/open_social | modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAnalyticsLikes.php | UserAnalyticsLikes.getValue | public function getValue(UserInterface $entity) {
$query = $this->database->select('votingapi_vote', 'v');
$query->condition('v.user_id', $entity->id());
return (int) $query
->countQuery()
->execute()
->fetchField();
} | php | public function getValue(UserInterface $entity) {
$query = $this->database->select('votingapi_vote', 'v');
$query->condition('v.user_id', $entity->id());
return (int) $query
->countQuery()
->execute()
->fetchField();
} | [
"public",
"function",
"getValue",
"(",
"UserInterface",
"$",
"entity",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"database",
"->",
"select",
"(",
"'votingapi_vote'",
",",
"'v'",
")",
";",
"$",
"query",
"->",
"condition",
"(",
"'v.user_id'",
",",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAnalyticsLikes.php#L29-L37 |
goalgorilla/open_social | modules/social_features/social_core/src/ContentTranslationConfigOverrideBase.php | ContentTranslationConfigOverrideBase.loadOverrides | public function loadOverrides($names) {
$overrides = [];
// This setting can't be changed in an override because that would create
// and endless loop in trying to apply the override.
$settings = \Drupal::configFactory()->getEditable('social_content_translation.settings');
$is_enabled = $settings->... | php | public function loadOverrides($names) {
$overrides = [];
// This setting can't be changed in an override because that would create
// and endless loop in trying to apply the override.
$settings = \Drupal::configFactory()->getEditable('social_content_translation.settings');
$is_enabled = $settings->... | [
"public",
"function",
"loadOverrides",
"(",
"$",
"names",
")",
"{",
"$",
"overrides",
"=",
"[",
"]",
";",
"// This setting can't be changed in an override because that would create",
"// and endless loop in trying to apply the override.",
"$",
"settings",
"=",
"\\",
"Drupal",... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/ContentTranslationConfigOverrideBase.php#L54-L73 |
goalgorilla/open_social | modules/social_features/social_core/src/ContentTranslationConfigOverrideBase.php | ContentTranslationConfigOverrideBase.getCacheableMetadata | public function getCacheableMetadata($name) {
$metadata = new CacheableMetadata();
if (in_array($name, $this->getOverriddenConfigurations())) {
$metadata->addCacheTags(['config:social_content_translation.settings']);
}
return $metadata;
} | php | public function getCacheableMetadata($name) {
$metadata = new CacheableMetadata();
if (in_array($name, $this->getOverriddenConfigurations())) {
$metadata->addCacheTags(['config:social_content_translation.settings']);
}
return $metadata;
} | [
"public",
"function",
"getCacheableMetadata",
"(",
"$",
"name",
")",
"{",
"$",
"metadata",
"=",
"new",
"CacheableMetadata",
"(",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"getOverriddenConfigurations",
"(",
")",
")",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/ContentTranslationConfigOverrideBase.php#L95-L101 |
goalgorilla/open_social | modules/social_features/social_post/src/Plugin/Block/PostGroupBlock.php | PostGroupBlock.blockAccess | protected function blockAccess(AccountInterface $account) {
$group = _social_group_get_current_group();
if (is_object($group)) {
if ($group->hasPermission('add post entities in group', $account) && $account->hasPermission("add post entities")) {
$membership = $group->getMember($account);
... | php | protected function blockAccess(AccountInterface $account) {
$group = _social_group_get_current_group();
if (is_object($group)) {
if ($group->hasPermission('add post entities in group', $account) && $account->hasPermission("add post entities")) {
$membership = $group->getMember($account);
... | [
"protected",
"function",
"blockAccess",
"(",
"AccountInterface",
"$",
"account",
")",
"{",
"$",
"group",
"=",
"_social_group_get_current_group",
"(",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"group",
")",
")",
"{",
"if",
"(",
"$",
"group",
"->",
"hasPer... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/src/Plugin/Block/PostGroupBlock.php#L32-L51 |
goalgorilla/open_social | modules/social_features/social_group/modules/social_group_members_export/src/Plugin/Action/ExportMember.php | ExportMember.executeMultiple | public function executeMultiple(array $entities) {
/** @var \Drupal\group\Entity\GroupContentInterface $entity */
foreach ($entities as &$entity) {
$entity = $entity->getEntity();
}
parent::executeMultiple($entities);
} | php | public function executeMultiple(array $entities) {
/** @var \Drupal\group\Entity\GroupContentInterface $entity */
foreach ($entities as &$entity) {
$entity = $entity->getEntity();
}
parent::executeMultiple($entities);
} | [
"public",
"function",
"executeMultiple",
"(",
"array",
"$",
"entities",
")",
"{",
"/** @var \\Drupal\\group\\Entity\\GroupContentInterface $entity */",
"foreach",
"(",
"$",
"entities",
"as",
"&",
"$",
"entity",
")",
"{",
"$",
"entity",
"=",
"$",
"entity",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_members_export/src/Plugin/Action/ExportMember.php#L25-L32 |
goalgorilla/open_social | modules/social_features/social_group/modules/social_group_members_export/src/Plugin/Action/ExportMember.php | ExportMember.getFileTemporaryPath | public function getFileTemporaryPath() {
$hash = md5(microtime(TRUE));
$filename = 'export-members-' . substr($hash, 20, 12) . '.csv';
return file_directory_temp() . '/' . $filename;
} | php | public function getFileTemporaryPath() {
$hash = md5(microtime(TRUE));
$filename = 'export-members-' . substr($hash, 20, 12) . '.csv';
return file_directory_temp() . '/' . $filename;
} | [
"public",
"function",
"getFileTemporaryPath",
"(",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"microtime",
"(",
"TRUE",
")",
")",
";",
"$",
"filename",
"=",
"'export-members-'",
".",
"substr",
"(",
"$",
"hash",
",",
"20",
",",
"12",
")",
".",
"'.csv'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_members_export/src/Plugin/Action/ExportMember.php#L51-L55 |
goalgorilla/open_social | modules/custom/social_auth_twitter/src/Controller/TwitterLinkController.php | TwitterLinkController.linkAccountCallback | public function linkAccountCallback() {
$sdk = $this->getSdk();
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$network_manager = $this->networkManager->createInstance('social_auth_twitter');
$data_handler = $network_manager->getDataHandler();
// Get the Twitter OAuth token from... | php | public function linkAccountCallback() {
$sdk = $this->getSdk();
if ($sdk instanceof RedirectResponse) {
return $sdk;
}
$network_manager = $this->networkManager->createInstance('social_auth_twitter');
$data_handler = $network_manager->getDataHandler();
// Get the Twitter OAuth token from... | [
"public",
"function",
"linkAccountCallback",
"(",
")",
"{",
"$",
"sdk",
"=",
"$",
"this",
"->",
"getSdk",
"(",
")",
";",
"if",
"(",
"$",
"sdk",
"instanceof",
"RedirectResponse",
")",
"{",
"return",
"$",
"sdk",
";",
"}",
"$",
"network_manager",
"=",
"$"... | 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_twitter/src/Controller/TwitterLinkController.php#L69-L139 |
goalgorilla/open_social | modules/social_features/social_event/src/Form/EventSettingsForm.php | EventSettingsForm.buildForm | public function buildForm(array $form, FormStateInterface $form_state) {
$group_type_ids = $this->configFactory->getEditable('social_event.settings')
->get('enroll');
$form['enroll'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Enroll user which is not group member'),
'#descriptio... | php | public function buildForm(array $form, FormStateInterface $form_state) {
$group_type_ids = $this->configFactory->getEditable('social_event.settings')
->get('enroll');
$form['enroll'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Enroll user which is not group member'),
'#descriptio... | [
"public",
"function",
"buildForm",
"(",
"array",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"group_type_ids",
"=",
"$",
"this",
"->",
"configFactory",
"->",
"getEditable",
"(",
"'social_event.settings'",
")",
"->",
"get",
"(",
"'... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Form/EventSettingsForm.php#L35-L63 |
goalgorilla/open_social | modules/social_features/social_event/src/Form/EventSettingsForm.php | EventSettingsForm.submitForm | public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$group_type_ids = [];
foreach ($form_state->getValue('enroll') as $group_type_id => $enable) {
if ($enable) {
$group_type_ids[] = $group_type_id;
}
}
$this->confi... | php | public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$group_type_ids = [];
foreach ($form_state->getValue('enroll') as $group_type_id => $enable) {
if ($enable) {
$group_type_ids[] = $group_type_id;
}
}
$this->confi... | [
"public",
"function",
"submitForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"parent",
"::",
"submitForm",
"(",
"$",
"form",
",",
"$",
"form_state",
")",
";",
"$",
"group_type_ids",
"=",
"[",
"]",
";",
"fore... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/src/Form/EventSettingsForm.php#L68-L82 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_managers/src/Form/SocialEventManagersAddEnrolleeForm.php | SocialEventManagersAddEnrolleeForm.submitForm | public function submitForm(array &$form, FormStateInterface $form_state) {
$enroll_uid = $form_state->getValue('entity_id_new');
$event = $form_state->getValue('node_id');
$count = 0;
if (!empty($event) && !empty($enroll_uid)) {
// Create a new enrollment for the event.
foreach ($enroll_uid... | php | public function submitForm(array &$form, FormStateInterface $form_state) {
$enroll_uid = $form_state->getValue('entity_id_new');
$event = $form_state->getValue('node_id');
$count = 0;
if (!empty($event) && !empty($enroll_uid)) {
// Create a new enrollment for the event.
foreach ($enroll_uid... | [
"public",
"function",
"submitForm",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"enroll_uid",
"=",
"$",
"form_state",
"->",
"getValue",
"(",
"'entity_id_new'",
")",
";",
"$",
"event",
"=",
"$",
"form_state",
... | 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_event/modules/social_event_managers/src/Form/SocialEventManagersAddEnrolleeForm.php#L71-L111 |
goalgorilla/open_social | modules/social_features/social_event/modules/social_event_managers/src/Form/SocialEventManagersAddEnrolleeForm.php | SocialEventManagersAddEnrolleeForm.buildForm | public function buildForm(array $form, FormStateInterface $form_state) {
$form['#attributes']['class'][] = 'card card__block form--default form-wrapper form-group';
if (empty($nid)) {
$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof NodeInterface) {
// You can get n... | php | public function buildForm(array $form, FormStateInterface $form_state) {
$form['#attributes']['class'][] = 'card card__block form--default form-wrapper form-group';
if (empty($nid)) {
$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof NodeInterface) {
// You can get n... | [
"public",
"function",
"buildForm",
"(",
"array",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"form",
"[",
"'#attributes'",
"]",
"[",
"'class'",
"]",
"[",
"]",
"=",
"'card card__block form--default form-wrapper form-group'",
";",
"if",... | 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_event/modules/social_event_managers/src/Form/SocialEventManagersAddEnrolleeForm.php#L124-L176 |
goalgorilla/open_social | themes/socialbase/src/Plugin/Preprocess/Table.php | Table.preprocessVariables | public function preprocessVariables(Variables $variables) {
if (isset($variables['attributes']['id']) && strpos($variables['attributes']['id'], 'edit-field-files') !== FALSE) {
$variables['attributes']['class'][] = 'tablesaw';
$variables['attributes']['data-tablesaw-mode'] = 'stack';
}
parent::... | php | public function preprocessVariables(Variables $variables) {
if (isset($variables['attributes']['id']) && strpos($variables['attributes']['id'], 'edit-field-files') !== FALSE) {
$variables['attributes']['class'][] = 'tablesaw';
$variables['attributes']['data-tablesaw-mode'] = 'stack';
}
parent::... | [
"public",
"function",
"preprocessVariables",
"(",
"Variables",
"$",
"variables",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"variables",
"[",
"'attributes'",
"]",
"[",
"'id'",
"]",
")",
"&&",
"strpos",
"(",
"$",
"variables",
"[",
"'attributes'",
"]",
"[",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/Table.php#L20-L27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.