repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
goalgorilla/open_social
modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php
ActivityEntityReferenceFormatter.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { $view_mode = $this->getSetting('view_mode'); $elements = []; foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) { // Protect ourselves from recursive rendering. static $depth = 0; $depth++; ...
php
public function viewElements(FieldItemListInterface $items, $langcode) { $view_mode = $this->getSetting('view_mode'); $elements = []; foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) { // Protect ourselves from recursive rendering. static $depth = 0; $depth++; ...
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "$", "view_mode", "=", "$", "this", "->", "getSetting", "(", "'view_mode'", ")", ";", "$", "elements", "=", "[", "]", ";", "foreach", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php#L26-L58
goalgorilla/open_social
modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php
ActivityEntityReferenceFormatter.settingsForm
public function settingsForm(array $form, FormStateInterface $form_state) { $options = $this->entityDisplayRepository->getAllViewModes(); $only_view_modes = []; foreach ($options as $entity) { foreach ($entity as $key => $view_mode) { $only_view_modes[$key] = $view_mode['label']; } }...
php
public function settingsForm(array $form, FormStateInterface $form_state) { $options = $this->entityDisplayRepository->getAllViewModes(); $only_view_modes = []; foreach ($options as $entity) { foreach ($entity as $key => $view_mode) { $only_view_modes[$key] = $view_mode['label']; } }...
[ "public", "function", "settingsForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "options", "=", "$", "this", "->", "entityDisplayRepository", "->", "getAllViewModes", "(", ")", ";", "$", "only_view_modes", "=", "["...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_viewer/src/Plugin/Field/FieldFormatter/ActivityEntityReferenceFormatter.php#L63-L81
goalgorilla/open_social
modules/social_features/social_core/src/Plugin/Field/FieldFormatter/CommentNodeFormatter.php
CommentNodeFormatter.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { $elements = []; $output = []; $field_name = $this->fieldDefinition->getName(); $entity = $items->getEntity(); $status = $items->status; $access_comments_in_group = FALSE; // Exclude entities without the set id. if...
php
public function viewElements(FieldItemListInterface $items, $langcode) { $elements = []; $output = []; $field_name = $this->fieldDefinition->getName(); $entity = $items->getEntity(); $status = $items->status; $access_comments_in_group = FALSE; // Exclude entities without the set id. if...
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "$", "elements", "=", "[", "]", ";", "$", "output", "=", "[", "]", ";", "$", "field_name", "=", "$", "this", "->", "fieldDefinition", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/Plugin/Field/FieldFormatter/CommentNodeFormatter.php#L45-L161
goalgorilla/open_social
modules/social_features/social_core/src/Plugin/Field/FieldFormatter/CommentNodeFormatter.php
CommentNodeFormatter.loadThread
public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0) { // @TODO: Refactor this to use CommentDefaultFormatter->loadThread with dependency injection instead. $query = db_select('comment_field_data', 'c'); $query->addField('c', 'cid'); $query ...
php
public function loadThread(EntityInterface $entity, $field_name, $mode, $comments_per_page = 0, $pager_id = 0) { // @TODO: Refactor this to use CommentDefaultFormatter->loadThread with dependency injection instead. $query = db_select('comment_field_data', 'c'); $query->addField('c', 'cid'); $query ...
[ "public", "function", "loadThread", "(", "EntityInterface", "$", "entity", ",", "$", "field_name", ",", "$", "mode", ",", "$", "comments_per_page", "=", "0", ",", "$", "pager_id", "=", "0", ")", "{", "// @TODO: Refactor this to use CommentDefaultFormatter->loadThrea...
{@inheritdoc} @see Drupal\comment\CommentStorage::loadThead()
[ "{", "@inheritdoc", "}" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_core/src/Plugin/Field/FieldFormatter/CommentNodeFormatter.php#L196-L239
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/Action/SocialEventAnEnrollSendEmail.php
SocialEventAnEnrollSendEmail.execute
public function execute($entity = NULL) { $this->entity = $entity; if ($this->socialEventAnEnrollManager->isGuest($entity)) { $display_name = $this->socialEventAnEnrollManager->getGuestName($entity, FALSE); if (!$display_name) { $display_name = t('Guest'); } $this->configurati...
php
public function execute($entity = NULL) { $this->entity = $entity; if ($this->socialEventAnEnrollManager->isGuest($entity)) { $display_name = $this->socialEventAnEnrollManager->getGuestName($entity, FALSE); if (!$display_name) { $display_name = t('Guest'); } $this->configurati...
[ "public", "function", "execute", "(", "$", "entity", "=", "NULL", ")", "{", "$", "this", "->", "entity", "=", "$", "entity", ";", "if", "(", "$", "this", "->", "socialEventAnEnrollManager", "->", "isGuest", "(", "$", "entity", ")", ")", "{", "$", "di...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/Action/SocialEventAnEnrollSendEmail.php#L102-L116
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/Action/SocialEventAnEnrollSendEmail.php
SocialEventAnEnrollSendEmail.getEmail
public function getEmail(UserInterface $account) { if ($account->isAnonymous()) { return $this->entity->field_email->value; } return parent::getEmail($account); }
php
public function getEmail(UserInterface $account) { if ($account->isAnonymous()) { return $this->entity->field_email->value; } return parent::getEmail($account); }
[ "public", "function", "getEmail", "(", "UserInterface", "$", "account", ")", "{", "if", "(", "$", "account", "->", "isAnonymous", "(", ")", ")", "{", "return", "$", "this", "->", "entity", "->", "field_email", "->", "value", ";", "}", "return", "parent",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/Action/SocialEventAnEnrollSendEmail.php#L121-L127
goalgorilla/open_social
modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php
CommentGroupContentFormatter.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { $output = parent::viewElements($items, $langcode); $entity = $items->getEntity(); // Exclude entities without the set id. if (!empty($entity->id())) { $group_contents = GroupContent::loadByEntity($entity); } if (!em...
php
public function viewElements(FieldItemListInterface $items, $langcode) { $output = parent::viewElements($items, $langcode); $entity = $items->getEntity(); // Exclude entities without the set id. if (!empty($entity->id())) { $group_contents = GroupContent::loadByEntity($entity); } if (!em...
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "$", "output", "=", "parent", "::", "viewElements", "(", "$", "items", ",", "$", "langcode", ")", ";", "$", "entity", "=", "$", "items", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php#L28-L76
goalgorilla/open_social
modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php
CommentGroupContentFormatter.getPermissionInGroups
protected function getPermissionInGroups($perm, AccountInterface $account, $group_contents, &$output) { $renderer = \Drupal::service('renderer'); foreach ($group_contents as $group_content) { $group = $group_content->getGroup(); // Add cacheable dependency. $membership = $group->getMember($a...
php
protected function getPermissionInGroups($perm, AccountInterface $account, $group_contents, &$output) { $renderer = \Drupal::service('renderer'); foreach ($group_contents as $group_content) { $group = $group_content->getGroup(); // Add cacheable dependency. $membership = $group->getMember($a...
[ "protected", "function", "getPermissionInGroups", "(", "$", "perm", ",", "AccountInterface", "$", "account", ",", "$", "group_contents", ",", "&", "$", "output", ")", "{", "$", "renderer", "=", "\\", "Drupal", "::", "service", "(", "'renderer'", ")", ";", ...
Checks if account was granted permission in group.
[ "Checks", "if", "account", "was", "granted", "permission", "in", "group", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php#L81-L97
goalgorilla/open_social
modules/social_features/social_user/src/Plugin/Block/SocialUserLoginBlock.php
SocialUserLoginBlock.build
public function build() { $form = \Drupal::formBuilder()->getForm('Drupal\social_user\Form\SocialUserLoginForm'); unset($form['name_or_mail']['#attributes']['autofocus']); // When unsetting field descriptions, also unset aria-describedby attributes // to avoid introducing an accessibility bug. // @t...
php
public function build() { $form = \Drupal::formBuilder()->getForm('Drupal\social_user\Form\SocialUserLoginForm'); unset($form['name_or_mail']['#attributes']['autofocus']); // When unsetting field descriptions, also unset aria-describedby attributes // to avoid introducing an accessibility bug. // @t...
[ "public", "function", "build", "(", ")", "{", "$", "form", "=", "\\", "Drupal", "::", "formBuilder", "(", ")", "->", "getForm", "(", "'Drupal\\social_user\\Form\\SocialUserLoginForm'", ")", ";", "unset", "(", "$", "form", "[", "'name_or_mail'", "]", "[", "'#...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Plugin/Block/SocialUserLoginBlock.php#L21-L72
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php
EventAnEnrollOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Add field_event_an_enroll to event form. $config_name = 'core.entity_form_display.node.event.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable...
php
public function loadOverrides($names) { $overrides = []; $config_factory = \Drupal::service('config.factory'); // Add field_event_an_enroll to event form. $config_name = 'core.entity_form_display.node.event.default'; if (in_array($config_name, $names)) { $config = $config_factory->getEditable...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_factory", "=", "\\", "Drupal", "::", "service", "(", "'config.factory'", ")", ";", "// Add field_event_an_enroll to event form.", "$", "config_...
Returns config overrides.
[ "Returns", "config", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollOverride.php#L21-L83
goalgorilla/open_social
modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php
SocialGroupQuickjoinSettings.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('social_group_quickjoin.settings'); $form['help'] = [ '#type' => 'item', '#markup' => $this->t("Enabling this feature gives site builders the possibility to create group 'quick join' links (ex., /group/...
php
public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('social_group_quickjoin.settings'); $form['help'] = [ '#type' => 'item', '#markup' => $this->t("Enabling this feature gives site builders the possibility to create group 'quick join' links (ex., /group/...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "config", "=", "$", "this", "->", "config", "(", "'social_group_quickjoin.settings'", ")", ";", "$", "form", "[", "'help'", "]", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php#L35-L80
goalgorilla/open_social
modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php
SocialGroupQuickjoinSettings.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); // Set the value for the general setting. $this->config('social_group_quickjoin.settings') ->set('social_group_quickjoin_enabled', $form_state->getValue('social_group_quickjoin_enabled')...
php
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); // Set the value for the general setting. $this->config('social_group_quickjoin.settings') ->set('social_group_quickjoin_enabled', $form_state->getValue('social_group_quickjoin_enabled')...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "parent", "::", "submitForm", "(", "$", "form", ",", "$", "form_state", ")", ";", "// Set the value for the general setting.", "$", "this"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php#L85-L104
goalgorilla/open_social
modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php
SocialGroupQuickjoinSettings.getGroups
protected function getGroups() { $types = []; /** @var \Drupal\group\Entity\GroupType $group_type */ foreach (GroupType::loadMultiple() as $group_type) { // We can only select group types that have the 'join group' // permission enabled. if (in_array('join group', $group_type->getOutsiderR...
php
protected function getGroups() { $types = []; /** @var \Drupal\group\Entity\GroupType $group_type */ foreach (GroupType::loadMultiple() as $group_type) { // We can only select group types that have the 'join group' // permission enabled. if (in_array('join group', $group_type->getOutsiderR...
[ "protected", "function", "getGroups", "(", ")", "{", "$", "types", "=", "[", "]", ";", "/** @var \\Drupal\\group\\Entity\\GroupType $group_type */", "foreach", "(", "GroupType", "::", "loadMultiple", "(", ")", "as", "$", "group_type", ")", "{", "// We can only selec...
Function that returns all groups that outsider can become a member of. @return array Joinable groups.
[ "Function", "that", "returns", "all", "groups", "that", "outsider", "can", "become", "a", "member", "of", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/modules/social_group_quickjoin/src/Form/SocialGroupQuickjoinSettings.php#L112-L123
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserNavigationSettingsForm.php
SocialUserNavigationSettingsForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { // Get the configuration file. $config = $this->config('social_user.navigation.settings'); $form['navigation_settings'] = [ '#type' => 'fieldset', '#title' => $this->t('Display icon configuration'), '#description' =...
php
public function buildForm(array $form, FormStateInterface $form_state) { // Get the configuration file. $config = $this->config('social_user.navigation.settings'); $form['navigation_settings'] = [ '#type' => 'fieldset', '#title' => $this->t('Display icon configuration'), '#description' =...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "// Get the configuration file.", "$", "config", "=", "$", "this", "->", "config", "(", "'social_user.navigation.settings'", ")", ";", "$", "form"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserNavigationSettingsForm.php#L61-L94
goalgorilla/open_social
modules/social_features/social_user/src/Form/SocialUserNavigationSettingsForm.php
SocialUserNavigationSettingsForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { // Get the configuration file. $config = $this->config('social_user.navigation.settings'); $config->set('display_social_private_message_icon', $form_state->getValue('display_social_private_message_icon')) ->set('display_my_gro...
php
public function submitForm(array &$form, FormStateInterface $form_state) { // Get the configuration file. $config = $this->config('social_user.navigation.settings'); $config->set('display_social_private_message_icon', $form_state->getValue('display_social_private_message_icon')) ->set('display_my_gro...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "// Get the configuration file.", "$", "config", "=", "$", "this", "->", "config", "(", "'social_user.navigation.settings'", ")", ";", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user/src/Form/SocialUserNavigationSettingsForm.php#L99-L108
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php
SocialGroupSelectorWidget.getOptions
protected function getOptions(FieldableEntityInterface $entity) { if (!isset($this->options)) { // Must be a node. if ($entity->getEntityTypeId() !== 'node') { // We only handle nodes. When using this widget on other content types, // we simply return the normal options. return ...
php
protected function getOptions(FieldableEntityInterface $entity) { if (!isset($this->options)) { // Must be a node. if ($entity->getEntityTypeId() !== 'node') { // We only handle nodes. When using this widget on other content types, // we simply return the normal options. return ...
[ "protected", "function", "getOptions", "(", "FieldableEntityInterface", "$", "entity", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "options", ")", ")", "{", "// Must be a node.", "if", "(", "$", "entity", "->", "getEntityTypeId", "(", ")", "...
Returns the array of options for the widget. @param \Drupal\Core\Entity\FieldableEntityInterface $entity The entity for which to return options. @return array The array of options for the widget.
[ "Returns", "the", "array", "of", "options", "for", "the", "widget", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php#L84-L149
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php
SocialGroupSelectorWidget.formElement
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); $element['#suffix'] = '<div id="group-selection-result"></div>'; $element['#ajax'] = [ 'call...
php
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); $element['#suffix'] = '<div id="group-selection-result"></div>'; $element['#ajax'] = [ 'call...
[ "public", "function", "formElement", "(", "FieldItemListInterface", "$", "items", ",", "$", "delta", ",", "array", "$", "element", ",", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "element", "=", "parent", "::", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php#L154-L194
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php
SocialGroupSelectorWidget.validateGroupSelection
public static function validateGroupSelection(array $form, FormStateInterface $form_state) { $ajax_response = new AjaxResponse(); $selected_visibility = $form_state->getValue('field_content_visibility'); if (!empty($selected_visibility)) { $selected_visibility = $selected_visibility['0']['value']; ...
php
public static function validateGroupSelection(array $form, FormStateInterface $form_state) { $ajax_response = new AjaxResponse(); $selected_visibility = $form_state->getValue('field_content_visibility'); if (!empty($selected_visibility)) { $selected_visibility = $selected_visibility['0']['value']; ...
[ "public", "static", "function", "validateGroupSelection", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "ajax_response", "=", "new", "AjaxResponse", "(", ")", ";", "$", "selected_visibility", "=", "$", "form_state", "->"...
Validate the group selection and change the visibility settings. @param array $form Form to process. @param \Drupal\Core\Form\FormStateInterface $form_state Form state to process. @return \Drupal\Core\Ajax\AjaxResponse Response changing values of the visibility field and set status message.
[ "Validate", "the", "group", "selection", "and", "change", "the", "visibility", "settings", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php#L207-L258
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php
SocialGroupSelectorWidget.removeGroupsWithoutCreateAccess
private function removeGroupsWithoutCreateAccess(array $options, User $account, EntityInterface $entity) { foreach ($options as $option_category_key => $groups_in_category) { if (is_array($groups_in_category)) { foreach ($groups_in_category as $gid => $group_title) { if (!$this->checkGroupC...
php
private function removeGroupsWithoutCreateAccess(array $options, User $account, EntityInterface $entity) { foreach ($options as $option_category_key => $groups_in_category) { if (is_array($groups_in_category)) { foreach ($groups_in_category as $gid => $group_title) { if (!$this->checkGroupC...
[ "private", "function", "removeGroupsWithoutCreateAccess", "(", "array", "$", "options", ",", "User", "$", "account", ",", "EntityInterface", "$", "entity", ")", "{", "foreach", "(", "$", "options", "as", "$", "option_category_key", "=>", "$", "groups_in_category",...
Remove options from the list. @param array $options A list of options to check. @param \Drupal\user\Entity\User $account The user to check for. @param \Drupal\Core\Entity\EntityInterface $entity The entity to check for. @return array An list of options for the field containing groups with create access.
[ "Remove", "options", "from", "the", "list", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php#L273-L295
goalgorilla/open_social
modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php
SocialGroupSelectorWidget.checkGroupContentCreateAccess
private function checkGroupContentCreateAccess($gid, User $account, EntityInterface $entity) { $group = Group::load($gid); if ($group->hasPermission('create group_' . $entity->getEntityTypeId() . ':' . $entity->bundle() . ' entity', $account)) { if ($group->getGroupType()->id() === 'public_group') { ...
php
private function checkGroupContentCreateAccess($gid, User $account, EntityInterface $entity) { $group = Group::load($gid); if ($group->hasPermission('create group_' . $entity->getEntityTypeId() . ':' . $entity->bundle() . ' entity', $account)) { if ($group->getGroupType()->id() === 'public_group') { ...
[ "private", "function", "checkGroupContentCreateAccess", "(", "$", "gid", ",", "User", "$", "account", ",", "EntityInterface", "$", "entity", ")", "{", "$", "group", "=", "Group", "::", "load", "(", "$", "gid", ")", ";", "if", "(", "$", "group", "->", "...
Check if user may create content of bundle in group. @param int $gid Group id. @param \Drupal\user\Entity\User $account The user to check for. @param \Drupal\Core\Entity\EntityInterface $entity The node bundle to check for. @return int Either TRUE or FALSE.
[ "Check", "if", "user", "may", "create", "content", "of", "bundle", "in", "group", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Plugin/Field/FieldWidget/SocialGroupSelectorWidget.php#L310-L323
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityListBuilder.php
ActivityListBuilder.buildRow
public function buildRow(EntityInterface $entity) { /* @var $entity \Drupal\activity_creator\Entity\Activity */ $row['id'] = $entity->id(); $row['name'] = $this->l( $entity->label(), new Url( 'entity.activity.edit_form', [ 'activity' => $entity->id(), ] ) ); ...
php
public function buildRow(EntityInterface $entity) { /* @var $entity \Drupal\activity_creator\Entity\Activity */ $row['id'] = $entity->id(); $row['name'] = $this->l( $entity->label(), new Url( 'entity.activity.edit_form', [ 'activity' => $entity->id(), ] ) ); ...
[ "public", "function", "buildRow", "(", "EntityInterface", "$", "entity", ")", "{", "/* @var $entity \\Drupal\\activity_creator\\Entity\\Activity */", "$", "row", "[", "'id'", "]", "=", "$", "entity", "->", "id", "(", ")", ";", "$", "row", "[", "'name'", "]", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityListBuilder.php#L30-L42
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php
DropdownWidgetType.formElement
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $this->required = $element['#required']; $this->multiple = $this->fieldDefinition->getFieldStorageDefinition()->isMultiple(); $this->has_value = isset($items[$delta]->{$this->c...
php
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $this->required = $element['#required']; $this->multiple = $this->fieldDefinition->getFieldStorageDefinition()->isMultiple(); $this->has_value = isset($items[$delta]->{$this->c...
[ "public", "function", "formElement", "(", "FieldItemListInterface", "$", "items", ",", "$", "delta", ",", "array", "$", "element", ",", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "this", "->", "required", "=", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php#L70-L89
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php
DropdownWidgetType.getOptions
protected function getOptions(FieldableEntityInterface $entity) { if (!isset($this->options)) { // Limit the settable options for the current user account. $options = $this->fieldDefinition ->getFieldStorageDefinition() ->getSetting('allowed_values'); $module_handler = \Drupal::mo...
php
protected function getOptions(FieldableEntityInterface $entity) { if (!isset($this->options)) { // Limit the settable options for the current user account. $options = $this->fieldDefinition ->getFieldStorageDefinition() ->getSetting('allowed_values'); $module_handler = \Drupal::mo...
[ "protected", "function", "getOptions", "(", "FieldableEntityInterface", "$", "entity", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "options", ")", ")", "{", "// Limit the settable options for the current user account.", "$", "options", "=", "$", "th...
Returns the array of options for the widget. @param \Drupal\Core\Entity\FieldableEntityInterface $entity The entity for which to return options. @return array The array of options for the widget.
[ "Returns", "the", "array", "of", "options", "for", "the", "widget", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php#L100-L119
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php
DropdownWidgetType.validateElement
public static function validateElement(array $element, FormStateInterface $form_state) { if ($element['#required'] && $element['#value'] == '_none') { $form_state->setError($element, t('@name field is required.', ['@name' => $element['#title']])); } // Save the value in the element key_column. //...
php
public static function validateElement(array $element, FormStateInterface $form_state) { if ($element['#required'] && $element['#value'] == '_none') { $form_state->setError($element, t('@name field is required.', ['@name' => $element['#title']])); } // Save the value in the element key_column. //...
[ "public", "static", "function", "validateElement", "(", "array", "$", "element", ",", "FormStateInterface", "$", "form_state", ")", "{", "if", "(", "$", "element", "[", "'#required'", "]", "&&", "$", "element", "[", "'#value'", "]", "==", "'_none'", ")", "...
Form validation handler for widget elements. @param array $element The form element. @param \Drupal\Core\Form\FormStateInterface $form_state The form state.
[ "Form", "validation", "handler", "for", "widget", "elements", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php#L129-L139
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php
DropdownWidgetType.getSelectedOptions
protected function getSelectedOptions(FieldItemListInterface $items, $delta = 0) { // We need to check against a flat list of options. $options = $this->getOptions($items->getEntity()); $selected_options = []; foreach ($items as $item) { $value = $item->{$this->column}; // Keep the value if...
php
protected function getSelectedOptions(FieldItemListInterface $items, $delta = 0) { // We need to check against a flat list of options. $options = $this->getOptions($items->getEntity()); $selected_options = []; foreach ($items as $item) { $value = $item->{$this->column}; // Keep the value if...
[ "protected", "function", "getSelectedOptions", "(", "FieldItemListInterface", "$", "items", ",", "$", "delta", "=", "0", ")", "{", "// We need to check against a flat list of options.", "$", "options", "=", "$", "this", "->", "getOptions", "(", "$", "items", "->", ...
Determines selected options from the incoming field values. @param \Drupal\Core\Field\FieldItemListInterface $items The field values. @param int $delta (optional) The delta of the item to get options for. Defaults to 0. @return array The array of corresponding selected options.
[ "Determines", "selected", "options", "from", "the", "incoming", "field", "values", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldWidget/DropdownWidgetType.php#L152-L167
goalgorilla/open_social
modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php
CategorizedOptionsbuttonsWidget.formElement
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); // We can only overwrite the default behaviour if the user is allowed to // select multiple elemen...
php
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); // We can only overwrite the default behaviour if the user is allowed to // select multiple elemen...
[ "public", "function", "formElement", "(", "FieldItemListInterface", "$", "items", ",", "$", "delta", ",", "array", "$", "element", ",", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "element", "=", "parent", "::", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php#L32-L96
goalgorilla/open_social
modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php
CategorizedOptionsbuttonsWidget.validateElement
public static function validateElement(array $element, FormStateInterface $form_state) { // Only pre-process the validation if this is a categorized checkbox // element. if (isset($element['#checkbox_categories'])) { // This turns the tree back into a single checkbox element that our parent // w...
php
public static function validateElement(array $element, FormStateInterface $form_state) { // Only pre-process the validation if this is a categorized checkbox // element. if (isset($element['#checkbox_categories'])) { // This turns the tree back into a single checkbox element that our parent // w...
[ "public", "static", "function", "validateElement", "(", "array", "$", "element", ",", "FormStateInterface", "$", "form_state", ")", "{", "// Only pre-process the validation if this is a categorized checkbox", "// element.", "if", "(", "isset", "(", "$", "element", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php#L101-L127
goalgorilla/open_social
modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php
CategorizedOptionsbuttonsWidget.getGroupedOptions
protected function getGroupedOptions(array $options, array $selected) { $grouped_options = []; foreach ($options as $tid => $label) { // Start at the top for the current element. $group = &$grouped_options; // Find the position for this element based on its parent group. If it // conta...
php
protected function getGroupedOptions(array $options, array $selected) { $grouped_options = []; foreach ($options as $tid => $label) { // Start at the top for the current element. $group = &$grouped_options; // Find the position for this element based on its parent group. If it // conta...
[ "protected", "function", "getGroupedOptions", "(", "array", "$", "options", ",", "array", "$", "selected", ")", "{", "$", "grouped_options", "=", "[", "]", ";", "foreach", "(", "$", "options", "as", "$", "tid", "=>", "$", "label", ")", "{", "// Start at ...
Group the options with their parent taxonomy terms. This makes it easier to arrange them for display later. Relies on a proper ordering of parent > child from the taxonomy validation. @param array $options The options to group. @param array $selected The currently selected options. @return array A tree structure wit...
[ "Group", "the", "options", "with", "their", "parent", "taxonomy", "terms", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php#L143-L168
goalgorilla/open_social
modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php
CategorizedOptionsbuttonsWidget.getTaxonomyChildren
private function getTaxonomyChildren(array $parent, $hyphens = 0) { $children = []; $selected = []; foreach ($parent['children'] as $tid => $child) { $children[$tid] = str_repeat('-', $hyphens) . $child['label']; if ($child['selected']) { $selected[] = $tid; } if (!empty($ch...
php
private function getTaxonomyChildren(array $parent, $hyphens = 0) { $children = []; $selected = []; foreach ($parent['children'] as $tid => $child) { $children[$tid] = str_repeat('-', $hyphens) . $child['label']; if ($child['selected']) { $selected[] = $tid; } if (!empty($ch...
[ "private", "function", "getTaxonomyChildren", "(", "array", "$", "parent", ",", "$", "hyphens", "=", "0", ")", "{", "$", "children", "=", "[", "]", ";", "$", "selected", "=", "[", "]", ";", "foreach", "(", "$", "parent", "[", "'children'", "]", "as",...
Reaches into all children and flattens the taxonomy. This method is private for a reason. We don't handle extra nesting yet but could want to do this in the future. Do not rely on this method existing in the future. @param array $parent The parent whose children to recurse through. @param int $hyphens The number of h...
[ "Reaches", "into", "all", "children", "and", "flattens", "the", "taxonomy", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_profile/src/Plugin/Field/FieldWidget/CategorizedOptionsbuttonsWidget.php#L185-L205
goalgorilla/open_social
modules/social_features/social_post/modules/social_post_photo/src/SocialPostPhotoConfigOverride.php
SocialPostPhotoConfigOverride.loadOverrides
public function loadOverrides($names) { // @codingStandardsIgnoreEnd $overrides = []; $config_factory = \Drupal::service('config.factory'); // Temporary override to allow only 1 photo. $config_name = 'field.storage.post.field_post_image'; if (in_array($config_name, $names)) { $overrides[$...
php
public function loadOverrides($names) { // @codingStandardsIgnoreEnd $overrides = []; $config_factory = \Drupal::service('config.factory'); // Temporary override to allow only 1 photo. $config_name = 'field.storage.post.field_post_image'; if (in_array($config_name, $names)) { $overrides[$...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "// @codingStandardsIgnoreEnd", "$", "overrides", "=", "[", "]", ";", "$", "config_factory", "=", "\\", "Drupal", "::", "service", "(", "'config.factory'", ")", ";", "// Temporary override to allo...
Returns config overrides. @param array $names A list of configuration names that are being loaded. @return array An array keyed by configuration name of override data. Override data contains a nested array structure of overrides. @codingStandardsIgnoreStart
[ "Returns", "config", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_post/modules/social_post_photo/src/SocialPostPhotoConfigOverride.php#L25-L95
goalgorilla/open_social
themes/socialbase/src/Plugin/Preprocess/MenuLocalAction.php
MenuLocalAction.preprocessElement
public function preprocessElement(Element $element, Variables $variables) { parent::preprocessElement($element, $variables); $route_names = [ // Identify the `Add member` button on the manage members page of a group. 'view.group_manage_members.page_group_manage_members', // Identify the `Add...
php
public function preprocessElement(Element $element, Variables $variables) { parent::preprocessElement($element, $variables); $route_names = [ // Identify the `Add member` button on the manage members page of a group. 'view.group_manage_members.page_group_manage_members', // Identify the `Add...
[ "public", "function", "preprocessElement", "(", "Element", "$", "element", ",", "Variables", "$", "variables", ")", "{", "parent", "::", "preprocessElement", "(", "$", "element", ",", "$", "variables", ")", ";", "$", "route_names", "=", "[", "// Identify the `...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/themes/socialbase/src/Plugin/Preprocess/MenuLocalAction.php#L21-L41
goalgorilla/open_social
modules/custom/social_node_statistics/src/EventSubscriber/NodeViewSubscriber.php
NodeViewSubscriber.trackNodeView
public function trackNodeView(PostResponseEvent $event) { // If the response is a success (e.g. status code 200) we can proceed. if ($event->getResponse()->isSuccessful()) { // Check if we're on a node page. if ($this->routeMatcher->getRouteName() === 'entity.node.canonical') { $node = $this...
php
public function trackNodeView(PostResponseEvent $event) { // If the response is a success (e.g. status code 200) we can proceed. if ($event->getResponse()->isSuccessful()) { // Check if we're on a node page. if ($this->routeMatcher->getRouteName() === 'entity.node.canonical') { $node = $this...
[ "public", "function", "trackNodeView", "(", "PostResponseEvent", "$", "event", ")", "{", "// If the response is a success (e.g. status code 200) we can proceed.", "if", "(", "$", "event", "->", "getResponse", "(", ")", "->", "isSuccessful", "(", ")", ")", "{", "// Che...
This method is called when the KernelEvents::TERMINATE event is dispatched. @param \Symfony\Component\HttpKernel\Event\PostResponseEvent $event The event. @throws \Exception
[ "This", "method", "is", "called", "when", "the", "KernelEvents", "::", "TERMINATE", "event", "is", "dispatched", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_node_statistics/src/EventSubscriber/NodeViewSubscriber.php#L88-L134
goalgorilla/open_social
modules/social_features/social_group/src/SetGroupsForNodeService.php
SetGroupsForNodeService.setGroupsForNode
public function setGroupsForNode(NodeInterface $node, array $groups_to_remove, array $groups_to_add, array $original_groups = [], $is_new = FALSE) { $moved = FALSE; // If we don't have to add or remove groups, we don't need to move anything. // the node is just updated for other values. if (empty($grou...
php
public function setGroupsForNode(NodeInterface $node, array $groups_to_remove, array $groups_to_add, array $original_groups = [], $is_new = FALSE) { $moved = FALSE; // If we don't have to add or remove groups, we don't need to move anything. // the node is just updated for other values. if (empty($grou...
[ "public", "function", "setGroupsForNode", "(", "NodeInterface", "$", "node", ",", "array", "$", "groups_to_remove", ",", "array", "$", "groups_to_add", ",", "array", "$", "original_groups", "=", "[", "]", ",", "$", "is_new", "=", "FALSE", ")", "{", "$", "m...
Save groups for a given node. @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException @throws \Drupal\Core\Entity\EntityStorageException
[ "Save", "groups", "for", "a", "given", "node", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SetGroupsForNodeService.php#L51-L154
goalgorilla/open_social
modules/social_features/social_group/src/SetGroupsForNodeService.php
SetGroupsForNodeService.addGroupContent
public static function addGroupContent(NodeInterface $node, Group $group) { // TODO Check if group plugin id exists. $plugin_id = 'group_node:' . $node->bundle(); $group->addContent($node, $plugin_id, ['uid' => $node->getOwnerId()]); }
php
public static function addGroupContent(NodeInterface $node, Group $group) { // TODO Check if group plugin id exists. $plugin_id = 'group_node:' . $node->bundle(); $group->addContent($node, $plugin_id, ['uid' => $node->getOwnerId()]); }
[ "public", "static", "function", "addGroupContent", "(", "NodeInterface", "$", "node", ",", "Group", "$", "group", ")", "{", "// TODO Check if group plugin id exists.", "$", "plugin_id", "=", "'group_node:'", ".", "$", "node", "->", "bundle", "(", ")", ";", "$", ...
Creates a group content. @param \Drupal\node\NodeInterface $node Object of a node. @param \Drupal\group\Entity\Group $group Object of a group.
[ "Creates", "a", "group", "content", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SetGroupsForNodeService.php#L164-L168
goalgorilla/open_social
modules/social_features/social_group/src/SetGroupsForNodeService.php
SetGroupsForNodeService.removeGroupContent
public static function removeGroupContent(NodeInterface $node, Group $group) { // Try to load group content from entity. if ($group_contents = GroupContent::loadByEntity($node)) { /* @var @param \Drupal\group\Entity\GroupContent $group_content */ foreach ($group_contents as $group_content) { ...
php
public static function removeGroupContent(NodeInterface $node, Group $group) { // Try to load group content from entity. if ($group_contents = GroupContent::loadByEntity($node)) { /* @var @param \Drupal\group\Entity\GroupContent $group_content */ foreach ($group_contents as $group_content) { ...
[ "public", "static", "function", "removeGroupContent", "(", "NodeInterface", "$", "node", ",", "Group", "$", "group", ")", "{", "// Try to load group content from entity.", "if", "(", "$", "group_contents", "=", "GroupContent", "::", "loadByEntity", "(", "$", "node",...
Deletes a group content. @param \Drupal\node\NodeInterface $node Object of a node. @param \Drupal\group\Entity\Group $group Object of a group.
[ "Deletes", "a", "group", "content", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/SetGroupsForNodeService.php#L178-L188
goalgorilla/open_social
modules/custom/mentions/src/Form/MentionsTypeForm.php
MentionsTypeForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $plugin_names = $this->mentionsManager->getPluginNames(); $entity = $this->entity; $inputsettings = $entity->get('input'); $entity_id = isset($entity) ? $entity->id() : ''; $all_entitytypes = array_keys($this->entityTypeReposit...
php
public function buildForm(array $form, FormStateInterface $form_state) { $plugin_names = $this->mentionsManager->getPluginNames(); $entity = $this->entity; $inputsettings = $entity->get('input'); $entity_id = isset($entity) ? $entity->id() : ''; $all_entitytypes = array_keys($this->entityTypeReposit...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "plugin_names", "=", "$", "this", "->", "mentionsManager", "->", "getPluginNames", "(", ")", ";", "$", "entity", "=", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Form/MentionsTypeForm.php#L94-L244
goalgorilla/open_social
modules/custom/mentions/src/Form/MentionsTypeForm.php
MentionsTypeForm.actions
protected function actions(array $form, FormStateInterface $form_state) { $actions = parent::actions($form, $form_state); $actions['submit']['#value'] = $this->t('Save Mentions Type'); return $actions; }
php
protected function actions(array $form, FormStateInterface $form_state) { $actions = parent::actions($form, $form_state); $actions['submit']['#value'] = $this->t('Save Mentions Type'); return $actions; }
[ "protected", "function", "actions", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "actions", "=", "parent", "::", "actions", "(", "$", "form", ",", "$", "form_state", ")", ";", "$", "actions", "[", "'submit'", "]...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Form/MentionsTypeForm.php#L249-L253
goalgorilla/open_social
modules/custom/mentions/src/Form/MentionsTypeForm.php
MentionsTypeForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $form_state->setRedirect('entity.mentions_type.list'); }
php
public function submitForm(array &$form, FormStateInterface $form_state) { parent::submitForm($form, $form_state); $form_state->setRedirect('entity.mentions_type.list'); }
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "parent", "::", "submitForm", "(", "$", "form", ",", "$", "form_state", ")", ";", "$", "form_state", "->", "setRedirect", "(", "'ent...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Form/MentionsTypeForm.php#L258-L261
goalgorilla/open_social
modules/custom/mentions/src/Form/MentionsTypeForm.php
MentionsTypeForm.changeEntityTypeInForm
public function changeEntityTypeInForm(array &$form, FormStateInterface $form_state) { $entitytype_state = $form_state->getValue(['input', 'entity_type']); $entitytype_info = $this->entityTypeManager->getDefinition($entitytype_state); $id = $entitytype_info->getKey('id'); $label = $entitytype_info->getK...
php
public function changeEntityTypeInForm(array &$form, FormStateInterface $form_state) { $entitytype_state = $form_state->getValue(['input', 'entity_type']); $entitytype_info = $this->entityTypeManager->getDefinition($entitytype_state); $id = $entitytype_info->getKey('id'); $label = $entitytype_info->getK...
[ "public", "function", "changeEntityTypeInForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "entitytype_state", "=", "$", "form_state", "->", "getValue", "(", "[", "'input'", ",", "'entity_type'", "]", ")", ";",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/Form/MentionsTypeForm.php#L266-L280
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php
SocialPrivateMessageService.updateLastThreadCheckTime
public function updateLastThreadCheckTime(Entity $entity) { $this->userData->set('private_message', $this->currentUser->id(), 'private_message_thread:' . $entity->id(), $this->time->getRequestTime()); }
php
public function updateLastThreadCheckTime(Entity $entity) { $this->userData->set('private_message', $this->currentUser->id(), 'private_message_thread:' . $entity->id(), $this->time->getRequestTime()); }
[ "public", "function", "updateLastThreadCheckTime", "(", "Entity", "$", "entity", ")", "{", "$", "this", "->", "userData", "->", "set", "(", "'private_message'", ",", "$", "this", "->", "currentUser", "->", "id", "(", ")", ",", "'private_message_thread:'", ".",...
Update the last time the thread was checked by the user. @param \Drupal\Core\Entity\Entity $entity The thread entity.
[ "Update", "the", "last", "time", "the", "thread", "was", "checked", "by", "the", "user", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php#L45-L47
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php
SocialPrivateMessageService.deleteUserDataThreadInfo
public function deleteUserDataThreadInfo(Entity $entity) { $this->userData->delete('private_message', $this->currentUser->id(), 'private_message_thread:' . $entity->id()); }
php
public function deleteUserDataThreadInfo(Entity $entity) { $this->userData->delete('private_message', $this->currentUser->id(), 'private_message_thread:' . $entity->id()); }
[ "public", "function", "deleteUserDataThreadInfo", "(", "Entity", "$", "entity", ")", "{", "$", "this", "->", "userData", "->", "delete", "(", "'private_message'", ",", "$", "this", "->", "currentUser", "->", "id", "(", ")", ",", "'private_message_thread:'", "....
Remove the thread info from the user_data. @param \Drupal\Core\Entity\Entity $entity The thread entity.
[ "Remove", "the", "thread", "info", "from", "the", "user_data", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php#L55-L57
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php
SocialPrivateMessageService.updateUnreadCount
public function updateUnreadCount() { $unread = 0; // Get the user. $uid = $this->currentUser->id(); // Get all the thread id's for this user. $threads = $this->getAllThreadIdsForUser($uid); if (empty($threads)) { return $unread; } // Check the last time someone other than the c...
php
public function updateUnreadCount() { $unread = 0; // Get the user. $uid = $this->currentUser->id(); // Get all the thread id's for this user. $threads = $this->getAllThreadIdsForUser($uid); if (empty($threads)) { return $unread; } // Check the last time someone other than the c...
[ "public", "function", "updateUnreadCount", "(", ")", "{", "$", "unread", "=", "0", ";", "// Get the user.", "$", "uid", "=", "$", "this", "->", "currentUser", "->", "id", "(", ")", ";", "// Get all the thread id's for this user.", "$", "threads", "=", "$", "...
Update the unread thread count. @return int The number of unread threads.
[ "Update", "the", "unread", "thread", "count", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php#L65-L97
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php
SocialPrivateMessageService.getAllThreadIdsForUser
public function getAllThreadIdsForUser($uid) { $query = 'SELECT DISTINCT(thread.id), MAX(thread.updated) ' . 'FROM {private_message_threads} AS thread ' . 'JOIN {private_message_thread__members} AS member ' . 'ON member.entity_id = thread.id AND member.members_target_id = :uid ' . 'JOIN {pri...
php
public function getAllThreadIdsForUser($uid) { $query = 'SELECT DISTINCT(thread.id), MAX(thread.updated) ' . 'FROM {private_message_threads} AS thread ' . 'JOIN {private_message_thread__members} AS member ' . 'ON member.entity_id = thread.id AND member.members_target_id = :uid ' . 'JOIN {pri...
[ "public", "function", "getAllThreadIdsForUser", "(", "$", "uid", ")", "{", "$", "query", "=", "'SELECT DISTINCT(thread.id), MAX(thread.updated) '", ".", "'FROM {private_message_threads} AS thread '", ".", "'JOIN {private_message_thread__members} AS member '", ".", "'ON member.entit...
Copy function of the one in the private_message module to disable count. {@inheritdoc}
[ "Copy", "function", "of", "the", "one", "in", "the", "private_message", "module", "to", "disable", "count", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php#L104-L128
goalgorilla/open_social
modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php
SocialPrivateMessageService.getLastMessageFromOtherUser
public function getLastMessageFromOtherUser($uid, $thread_id) { $timestamp = $this->database->query( 'SELECT MAX(pm.created) ' . 'FROM {private_message_thread__private_messages} pmt ' . 'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' . 'WHERE pmt.entity_id = :thread A...
php
public function getLastMessageFromOtherUser($uid, $thread_id) { $timestamp = $this->database->query( 'SELECT MAX(pm.created) ' . 'FROM {private_message_thread__private_messages} pmt ' . 'JOIN {private_messages} pm ON pmt.private_messages_target_id = pm.id ' . 'WHERE pmt.entity_id = :thread A...
[ "public", "function", "getLastMessageFromOtherUser", "(", "$", "uid", ",", "$", "thread_id", ")", "{", "$", "timestamp", "=", "$", "this", "->", "database", "->", "query", "(", "'SELECT MAX(pm.created) '", ".", "'FROM {private_message_thread__private_messages} pmt '", ...
Last time a message was added to the thread by another user than current. @param int $uid The user id. @param int $thread_id The thread id. @return int The timestamp or 0 if nothing was found.
[ "Last", "time", "a", "message", "was", "added", "to", "the", "thread", "by", "another", "user", "than", "current", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Service/SocialPrivateMessageService.php#L166-L184
goalgorilla/open_social
modules/social_features/social_landing_page/src/Plugin/Field/FieldWidget/BlockFieldWidget.php
BlockFieldWidget.formElement
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); if ($element['#field_parents'][0] != 'field_landing_page_section') { return $element; } ...
php
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $element = parent::formElement($items, $delta, $element, $form, $form_state); if ($element['#field_parents'][0] != 'field_landing_page_section') { return $element; } ...
[ "public", "function", "formElement", "(", "FieldItemListInterface", "$", "items", ",", "$", "delta", ",", "array", "$", "element", ",", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "element", "=", "parent", "::", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_landing_page/src/Plugin/Field/FieldWidget/BlockFieldWidget.php#L25-L81
goalgorilla/open_social
modules/social_features/social_private_message/src/Plugin/Field/FieldFormatter/SocialPrivateMessageOwnerFormatter.php
SocialPrivateMessageOwnerFormatter.viewElements
public function viewElements(FieldItemListInterface $items, $langcode) { $elements = parent::viewElements($items, $langcode); if (empty($elements) && !$items->isEmpty()) { $elements[] = ['#plain_text' => $this->t('Deleted user')]; } return $elements; }
php
public function viewElements(FieldItemListInterface $items, $langcode) { $elements = parent::viewElements($items, $langcode); if (empty($elements) && !$items->isEmpty()) { $elements[] = ['#plain_text' => $this->t('Deleted user')]; } return $elements; }
[ "public", "function", "viewElements", "(", "FieldItemListInterface", "$", "items", ",", "$", "langcode", ")", "{", "$", "elements", "=", "parent", "::", "viewElements", "(", "$", "items", ",", "$", "langcode", ")", ";", "if", "(", "empty", "(", "$", "ele...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_private_message/src/Plugin/Field/FieldFormatter/SocialPrivateMessageOwnerFormatter.php#L25-L33
goalgorilla/open_social
modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php
SocialCommentAdminOverview.buildForm
public function buildForm(array $form, FormStateInterface $form_state, $type = 'new') { // Build an 'Update options' form. $form['options'] = [ '#type' => 'details', '#title' => $this->t('Update options'), '#open' => TRUE, '#attributes' => ['class' => ['container-inline']], ]; ...
php
public function buildForm(array $form, FormStateInterface $form_state, $type = 'new') { // Build an 'Update options' form. $form['options'] = [ '#type' => 'details', '#title' => $this->t('Update options'), '#open' => TRUE, '#attributes' => ['class' => ['container-inline']], ]; ...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ",", "$", "type", "=", "'new'", ")", "{", "// Build an 'Update options' form.", "$", "form", "[", "'options'", "]", "=", "[", "'#type'", "=>", "'details...
Form constructor for the comment overview administration form. @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. @param string $type The type of the overview form ('approval' or 'new'). @return array The...
[ "Form", "constructor", "for", "the", "comment", "overview", "administration", "form", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php#L120-L242
goalgorilla/open_social
modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php
SocialCommentAdminOverview.validateForm
public function validateForm(array &$form, FormStateInterface $form_state) { $form_state->setValue('comments', array_diff($form_state->getValue('comments'), [0])); // We can't execute any 'Update options' if no comments were selected. if (count($form_state->getValue('comments')) == 0) { $form_state->s...
php
public function validateForm(array &$form, FormStateInterface $form_state) { $form_state->setValue('comments', array_diff($form_state->getValue('comments'), [0])); // We can't execute any 'Update options' if no comments were selected. if (count($form_state->getValue('comments')) == 0) { $form_state->s...
[ "public", "function", "validateForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form_state", "->", "setValue", "(", "'comments'", ",", "array_diff", "(", "$", "form_state", "->", "getValue", "(", "'comments'"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php#L247-L253
goalgorilla/open_social
modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php
SocialCommentAdminOverview.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { $operation = $form_state->getValue('operation'); $cids = $form_state->getValue('comments'); /** @var \Drupal\comment\CommentInterface[] $comments */ $comments = $this->commentStorage->loadMultiple($cids); if ($operation != 'd...
php
public function submitForm(array &$form, FormStateInterface $form_state) { $operation = $form_state->getValue('operation'); $cids = $form_state->getValue('comments'); /** @var \Drupal\comment\CommentInterface[] $comments */ $comments = $this->commentStorage->loadMultiple($cids); if ($operation != 'd...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "operation", "=", "$", "form_state", "->", "getValue", "(", "'operation'", ")", ";", "$", "cids", "=", "$", "form_state", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php#L258-L288
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/Action/ExportAllEnrolments.php
ExportAllEnrolments.getPluginConfiguration
public function getPluginConfiguration($plugin_id, $entity_id) { $configuration = parent::getPluginConfiguration($plugin_id, $entity_id); $plugin_definition = &$this->pluginDefinitions[$plugin_id]; if ($plugin_definition['provider'] === 'social_event_an_enroll_enrolments_export') { $configuration['en...
php
public function getPluginConfiguration($plugin_id, $entity_id) { $configuration = parent::getPluginConfiguration($plugin_id, $entity_id); $plugin_definition = &$this->pluginDefinitions[$plugin_id]; if ($plugin_definition['provider'] === 'social_event_an_enroll_enrolments_export') { $configuration['en...
[ "public", "function", "getPluginConfiguration", "(", "$", "plugin_id", ",", "$", "entity_id", ")", "{", "$", "configuration", "=", "parent", "::", "getPluginConfiguration", "(", "$", "plugin_id", ",", "$", "entity_id", ")", ";", "$", "plugin_definition", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/Action/ExportAllEnrolments.php#L123-L132
goalgorilla/open_social
modules/custom/mentions/src/MentionsController.php
MentionsController.mentionPermalink
public function mentionPermalink(MentionsInterface $mentions) { if ($entity = $mentions->getMentionedEntity()) { // Check access permissions for the entity. if (!$entity->access('view')) { throw new AccessDeniedHttpException(); } $entity_url = $entity->toUrl('canonical'); retur...
php
public function mentionPermalink(MentionsInterface $mentions) { if ($entity = $mentions->getMentionedEntity()) { // Check access permissions for the entity. if (!$entity->access('view')) { throw new AccessDeniedHttpException(); } $entity_url = $entity->toUrl('canonical'); retur...
[ "public", "function", "mentionPermalink", "(", "MentionsInterface", "$", "mentions", ")", "{", "if", "(", "$", "entity", "=", "$", "mentions", "->", "getMentionedEntity", "(", ")", ")", "{", "// Check access permissions for the entity.", "if", "(", "!", "$", "en...
Redirects mention links to the correct page depending on entity context. Taken from: commentPermalink. @param \Drupal\mentions\MentionsInterface $mentions A mention entity. @return \Symfony\Component\HttpFoundation\Response The mention listing set to the page on which the mention appears. @throws \Symfony\Component...
[ "Redirects", "mention", "links", "to", "the", "correct", "page", "depending", "on", "entity", "context", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/MentionsController.php#L31-L41
goalgorilla/open_social
modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Form/LetsConnectUsageSettingsForm.php
LetsConnectUsageSettingsForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { // Filter out unchecked items. $usage_data = $form_state->getValue('usage_data'); foreach ($usage_data as $data => $value) { if (!$value) { unset($usage_data[$data]); } } // Save config. $config = $th...
php
public function submitForm(array &$form, FormStateInterface $form_state) { // Filter out unchecked items. $usage_data = $form_state->getValue('usage_data'); foreach ($usage_data as $data => $value) { if (!$value) { unset($usage_data[$data]); } } // Save config. $config = $th...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "// Filter out unchecked items.", "$", "usage_data", "=", "$", "form_state", "->", "getValue", "(", "'usage_data'", ")", ";", "foreach", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Form/LetsConnectUsageSettingsForm.php#L65-L82
goalgorilla/open_social
modules/custom/social_auth_google/src/GoogleAuthManager.php
GoogleAuthManager.getAuthenticationUrl
public function getAuthenticationUrl($type, array $scope = ['profile', 'email']) { $redirect_url = $this->getRedirectUrl($type); $this->sdk->setRedirectUri($redirect_url); return $this->sdk->createAuthUrl($scope); }
php
public function getAuthenticationUrl($type, array $scope = ['profile', 'email']) { $redirect_url = $this->getRedirectUrl($type); $this->sdk->setRedirectUri($redirect_url); return $this->sdk->createAuthUrl($scope); }
[ "public", "function", "getAuthenticationUrl", "(", "$", "type", ",", "array", "$", "scope", "=", "[", "'profile'", ",", "'email'", "]", ")", "{", "$", "redirect_url", "=", "$", "this", "->", "getRedirectUrl", "(", "$", "type", ")", ";", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/GoogleAuthManager.php#L44-L49
goalgorilla/open_social
modules/custom/social_auth_google/src/GoogleAuthManager.php
GoogleAuthManager.getAccessToken
public function getAccessToken($type) { $redirect_url = $this->getRedirectUrl($type); $this->sdk->setRedirectUri($redirect_url); return $this->sdk->authenticate(\Drupal::request()->get('code')); }
php
public function getAccessToken($type) { $redirect_url = $this->getRedirectUrl($type); $this->sdk->setRedirectUri($redirect_url); return $this->sdk->authenticate(\Drupal::request()->get('code')); }
[ "public", "function", "getAccessToken", "(", "$", "type", ")", "{", "$", "redirect_url", "=", "$", "this", "->", "getRedirectUrl", "(", "$", "type", ")", ";", "$", "this", "->", "sdk", "->", "setRedirectUri", "(", "$", "redirect_url", ")", ";", "return",...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/GoogleAuthManager.php#L61-L65
goalgorilla/open_social
modules/custom/social_auth_google/src/GoogleAuthManager.php
GoogleAuthManager.getProfile
public function getProfile() { if (empty($this->googleService)) { $this->googleService = new \Google_Service_Oauth2($this->sdk); } $this->profile = $this->googleService->userinfo->get(); return $this->profile; }
php
public function getProfile() { if (empty($this->googleService)) { $this->googleService = new \Google_Service_Oauth2($this->sdk); } $this->profile = $this->googleService->userinfo->get(); return $this->profile; }
[ "public", "function", "getProfile", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "googleService", ")", ")", "{", "$", "this", "->", "googleService", "=", "new", "\\", "Google_Service_Oauth2", "(", "$", "this", "->", "sdk", ")", ";", "}", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_google/src/GoogleAuthManager.php#L70-L78
goalgorilla/open_social
modules/social_features/social_search/src/Form/SearchHeroForm.php
SearchHeroForm.buildForm
public function buildForm(array $form, FormStateInterface $form_state) { $form['search_input'] = [ '#type' => 'textfield', ]; // Pre-fill search input on the search group page. $form['search_input']['#default_value'] = $this->routeMatch ->getParameter('keys'); $form['actions'] = ['#ty...
php
public function buildForm(array $form, FormStateInterface $form_state) { $form['search_input'] = [ '#type' => 'textfield', ]; // Pre-fill search input on the search group page. $form['search_input']['#default_value'] = $this->routeMatch ->getParameter('keys'); $form['actions'] = ['#ty...
[ "public", "function", "buildForm", "(", "array", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "form", "[", "'search_input'", "]", "=", "[", "'#type'", "=>", "'textfield'", ",", "]", ";", "// Pre-fill search input on the search group pa...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Form/SearchHeroForm.php#L69-L87
goalgorilla/open_social
modules/social_features/social_search/src/Form/SearchHeroForm.php
SearchHeroForm.submitForm
public function submitForm(array &$form, FormStateInterface $form_state) { $current_route = $this->routeMatch->getRouteName(); $route_parts = explode('.', $current_route); if (empty($form_state->getValue('search_input'))) { // Redirect to the search page with empty search values. $new_route = "v...
php
public function submitForm(array &$form, FormStateInterface $form_state) { $current_route = $this->routeMatch->getRouteName(); $route_parts = explode('.', $current_route); if (empty($form_state->getValue('search_input'))) { // Redirect to the search page with empty search values. $new_route = "v...
[ "public", "function", "submitForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "current_route", "=", "$", "this", "->", "routeMatch", "->", "getRouteName", "(", ")", ";", "$", "route_parts", "=", "explode", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_search/src/Form/SearchHeroForm.php#L92-L114
goalgorilla/open_social
modules/custom/social_demo/src/DemoContent.php
DemoContent.removeContent
public function removeContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { continue; } $entities = $this->entityStorage->loadByProperties([ 'uuid' => $uuid, ]); fore...
php
public function removeContent() { $data = $this->fetchData(); foreach ($data as $uuid => $item) { // Must have uuid and same key value. if ($uuid !== $item['uuid']) { continue; } $entities = $this->entityStorage->loadByProperties([ 'uuid' => $uuid, ]); fore...
[ "public", "function", "removeContent", "(", ")", "{", "$", "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/DemoContent.php#L88-L105
goalgorilla/open_social
modules/custom/social_demo/src/DemoContent.php
DemoContent.fetchData
protected function fetchData() { if (!$this->data) { $this->data = $this->parser->parseFileFromModule($this->getSource(), $this->getModule(), $this->getProfile()); } return $this->data; }
php
protected function fetchData() { if (!$this->data) { $this->data = $this->parser->parseFileFromModule($this->getSource(), $this->getModule(), $this->getProfile()); } return $this->data; }
[ "protected", "function", "fetchData", "(", ")", "{", "if", "(", "!", "$", "this", "->", "data", ")", "{", "$", "this", "->", "data", "=", "$", "this", "->", "parser", "->", "parseFileFromModule", "(", "$", "this", "->", "getSource", "(", ")", ",", ...
Gets the data from a file.
[ "Gets", "the", "data", "from", "a", "file", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoContent.php#L124-L130
goalgorilla/open_social
modules/custom/social_demo/src/DemoContent.php
DemoContent.loadByUuid
protected function loadByUuid($entity_type_id, $id, $all = FALSE) { if (property_exists($this, $entity_type_id . 'Storage')) { $storage = $this->{$entity_type_id . 'Storage'}; } else { $storage = \Drupal::entityTypeManager()->getStorage($entity_type_id); } if (is_numeric($id)) { $...
php
protected function loadByUuid($entity_type_id, $id, $all = FALSE) { if (property_exists($this, $entity_type_id . 'Storage')) { $storage = $this->{$entity_type_id . 'Storage'}; } else { $storage = \Drupal::entityTypeManager()->getStorage($entity_type_id); } if (is_numeric($id)) { $...
[ "protected", "function", "loadByUuid", "(", "$", "entity_type_id", ",", "$", "id", ",", "$", "all", "=", "FALSE", ")", "{", "if", "(", "property_exists", "(", "$", "this", ",", "$", "entity_type_id", ".", "'Storage'", ")", ")", "{", "$", "storage", "="...
Load entity by uuid. @param string $entity_type_id Identifier of entity type. @param string|int $id Identifier or uuid. @param bool $all If set true, method will return all loaded entity. If set false, will return only one. @return \Drupal\Core\Entity\EntityInterface|\Drupal\Core\Entity\EntityInterface[]|mixed Return...
[ "Load", "entity", "by", "uuid", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoContent.php#L146-L170
goalgorilla/open_social
modules/custom/social_demo/src/DemoContent.php
DemoContent.checkMentionOrLinkByUuid
protected function checkMentionOrLinkByUuid($content) { // Check if there's a mention in the given content. if (strpos($content, '[~') !== FALSE || strpos($content, '[link=') !== FALSE) { // Put the content in a logical var. $input = $content; $mention_uuid = ''; $link_uuid = ''; ...
php
protected function checkMentionOrLinkByUuid($content) { // Check if there's a mention in the given content. if (strpos($content, '[~') !== FALSE || strpos($content, '[link=') !== FALSE) { // Put the content in a logical var. $input = $content; $mention_uuid = ''; $link_uuid = ''; ...
[ "protected", "function", "checkMentionOrLinkByUuid", "(", "$", "content", ")", "{", "// Check if there's a mention in the given content.", "if", "(", "strpos", "(", "$", "content", ",", "'[~'", ")", "!==", "FALSE", "||", "strpos", "(", "$", "content", ",", "'[link...
Extract the mention from the content by [~Uuid]. @param string $content The content that contains the mention. @return mixed If nothing needs to be replaced, just return the same content.
[ "Extract", "the", "mention", "from", "the", "content", "by", "[", "~Uuid", "]", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoContent.php#L181-L243
goalgorilla/open_social
modules/custom/social_demo/src/DemoContent.php
DemoContent.prepareImage
protected function prepareImage($picture, $alt = '') { $value = NULL; $files = $this->loadByUuid('file', $picture); if ($files instanceof File) { $value = [ [ 'target_id' => $files->id(), 'alt' => $alt ?: 'file' . $files->id(), ], ]; } return $value;...
php
protected function prepareImage($picture, $alt = '') { $value = NULL; $files = $this->loadByUuid('file', $picture); if ($files instanceof File) { $value = [ [ 'target_id' => $files->id(), 'alt' => $alt ?: 'file' . $files->id(), ], ]; } return $value;...
[ "protected", "function", "prepareImage", "(", "$", "picture", ",", "$", "alt", "=", "''", ")", "{", "$", "value", "=", "NULL", ";", "$", "files", "=", "$", "this", "->", "loadByUuid", "(", "'file'", ",", "$", "picture", ")", ";", "if", "(", "$", ...
Prepares data about an image. @param string $picture The image uuid. @param string $alt The image alt text. @return array Returns an array for the image field.
[ "Prepares", "data", "about", "an", "image", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoContent.php#L256-L270
goalgorilla/open_social
modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserGroupMemberships.php
UserGroupMemberships.getValue
public function getValue(UserInterface $entity) { $group_memberships = Group::loadMultiple($this->groupHelper->getAllGroupsForUser($entity->id())); $groups = []; foreach ($group_memberships as $group) { $groups[] = "{$group->label()} ({$group->id()})"; } return implode(', ', $groups); }
php
public function getValue(UserInterface $entity) { $group_memberships = Group::loadMultiple($this->groupHelper->getAllGroupsForUser($entity->id())); $groups = []; foreach ($group_memberships as $group) { $groups[] = "{$group->label()} ({$group->id()})"; } return implode(', ', $groups); }
[ "public", "function", "getValue", "(", "UserInterface", "$", "entity", ")", "{", "$", "group_memberships", "=", "Group", "::", "loadMultiple", "(", "$", "this", "->", "groupHelper", "->", "getAllGroupsForUser", "(", "$", "entity", "->", "id", "(", ")", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserGroupMemberships.php#L93-L101
goalgorilla/open_social
modules/social_features/social_comment_upload/src/SocialCommentUploadConfigOverride.php
SocialCommentUploadConfigOverride.loadOverrides
public function loadOverrides($names) { $overrides = []; // We don't need to add any fields if uploads are disabled. // We use getEditable and getOriginal to avoid override loops. if ($this->configFactory->getEditable('social_comment_upload.settings')->getOriginal('allow_upload_comments', TRUE) == FALS...
php
public function loadOverrides($names) { $overrides = []; // We don't need to add any fields if uploads are disabled. // We use getEditable and getOriginal to avoid override loops. if ($this->configFactory->getEditable('social_comment_upload.settings')->getOriginal('allow_upload_comments', TRUE) == FALS...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "// We don't need to add any fields if uploads are disabled.", "// We use getEditable and getOriginal to avoid override loops.", "if", "(", "$", "this", "->", "configFa...
Returns config overrides.
[ "Returns", "config", "overrides", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_comment_upload/src/SocialCommentUploadConfigOverride.php#L39-L114
goalgorilla/open_social
modules/social_features/social_tagging/src/SocialTaggingOverrides.php
SocialTaggingOverrides.loadOverrides
public function loadOverrides($names) { $overrides = []; $config_names = [ 'views.view.search_content', 'views.view.search_groups', 'search_api.index.social_content', 'search_api.index.social_groups', 'views.view.latest_topics', 'views.view.upcoming_events', 'views.vie...
php
public function loadOverrides($names) { $overrides = []; $config_names = [ 'views.view.search_content', 'views.view.search_groups', 'search_api.index.social_content', 'search_api.index.social_groups', 'views.view.latest_topics', 'views.view.upcoming_events', 'views.vie...
[ "public", "function", "loadOverrides", "(", "$", "names", ")", "{", "$", "overrides", "=", "[", "]", ";", "$", "config_names", "=", "[", "'views.view.search_content'", ",", "'views.view.search_groups'", ",", "'search_api.index.social_content'", ",", "'search_api.index...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_tagging/src/SocialTaggingOverrides.php#L24-L290
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Event.php
Event.getEntry
protected function getEntry(array $item) { $entry = parent::getEntry($item); $entry['field_event_address'] = $item['field_event_address']; $entry['field_event_date'] = $this->createEventDate($item['field_event_date']); $entry['field_event_date_end'] = $this->createEventDate($item['field_event_date_end'...
php
protected function getEntry(array $item) { $entry = parent::getEntry($item); $entry['field_event_address'] = $item['field_event_address']; $entry['field_event_date'] = $this->createEventDate($item['field_event_date']); $entry['field_event_date_end'] = $this->createEventDate($item['field_event_date_end'...
[ "protected", "function", "getEntry", "(", "array", "$", "item", ")", "{", "$", "entry", "=", "parent", "::", "getEntry", "(", "$", "item", ")", ";", "$", "entry", "[", "'field_event_address'", "]", "=", "$", "item", "[", "'field_event_address'", "]", ";"...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Event.php#L69-L98
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Event.php
Event.createEventDate
protected function createEventDate($date_string) { // Split from delimiter. $timestamp = explode('|', $date_string); $date = strtotime($timestamp[0]); $date = date('Y-m-d', $date) . 'T' . $timestamp[1] . ':00'; return $date; }
php
protected function createEventDate($date_string) { // Split from delimiter. $timestamp = explode('|', $date_string); $date = strtotime($timestamp[0]); $date = date('Y-m-d', $date) . 'T' . $timestamp[1] . ':00'; return $date; }
[ "protected", "function", "createEventDate", "(", "$", "date_string", ")", "{", "// Split from delimiter.", "$", "timestamp", "=", "explode", "(", "'|'", ",", "$", "date_string", ")", ";", "$", "date", "=", "strtotime", "(", "$", "timestamp", "[", "0", "]", ...
Function to calculate the date.
[ "Function", "to", "calculate", "the", "date", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Event.php#L103-L112
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Event.php
Event.prepareAttachment
protected function prepareAttachment(array $files) { $attachments = NULL; foreach ($files as $file) { $description = ''; // If it is an array, this means we also have a description. if (is_array($file)) { $uuid = key($file); $description = current($file); } else {...
php
protected function prepareAttachment(array $files) { $attachments = NULL; foreach ($files as $file) { $description = ''; // If it is an array, this means we also have a description. if (is_array($file)) { $uuid = key($file); $description = current($file); } else {...
[ "protected", "function", "prepareAttachment", "(", "array", "$", "files", ")", "{", "$", "attachments", "=", "NULL", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "$", "description", "=", "''", ";", "// If it is an array, this means we also h...
Returns reference to attachment, possibly with a description. @param array $files Array with UUIDs of files. @return array|null Array containing related files or NULL.
[ "Returns", "reference", "to", "attachment", "possibly", "with", "a", "description", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Event.php#L123-L153
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Event.php
Event.prepareEventType
protected function prepareEventType($uuid) { $value = NULL; $terms = $this->termStorage->loadByProperties([ 'uuid' => $uuid, ]); if ($terms) { $value = [ [ 'target_id' => current($terms)->id(), ], ]; } return $value; }
php
protected function prepareEventType($uuid) { $value = NULL; $terms = $this->termStorage->loadByProperties([ 'uuid' => $uuid, ]); if ($terms) { $value = [ [ 'target_id' => current($terms)->id(), ], ]; } return $value; }
[ "protected", "function", "prepareEventType", "(", "$", "uuid", ")", "{", "$", "value", "=", "NULL", ";", "$", "terms", "=", "$", "this", "->", "termStorage", "->", "loadByProperties", "(", "[", "'uuid'", "=>", "$", "uuid", ",", "]", ")", ";", "if", "...
Returns taxonomy term id. @param string $uuid The uuid. @return array|null Returns an array or null.
[ "Returns", "taxonomy", "term", "id", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Event.php#L164-L179
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Event.php
Event.prepareEventManagers
protected function prepareEventManagers(array $managers) { $values = NULL; foreach ($managers as $uuid) { // Load the user(s) by the given uuid(s). $load = $this->userStorage->loadByProperties(['uuid' => $uuid]); $account = current($load); if ($account instanceof User) { $prope...
php
protected function prepareEventManagers(array $managers) { $values = NULL; foreach ($managers as $uuid) { // Load the user(s) by the given uuid(s). $load = $this->userStorage->loadByProperties(['uuid' => $uuid]); $account = current($load); if ($account instanceof User) { $prope...
[ "protected", "function", "prepareEventManagers", "(", "array", "$", "managers", ")", "{", "$", "values", "=", "NULL", ";", "foreach", "(", "$", "managers", "as", "$", "uuid", ")", "{", "// Load the user(s) by the given uuid(s).", "$", "load", "=", "$", "this",...
Returns event managers. @param array $managers An array of uuids. @return array|null Returns an array or null.
[ "Returns", "event", "managers", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/Event.php#L190-L207
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php
LinkedInAuthController.getRedirectResponse
protected function getRedirectResponse($type) { $sdk = $this->getSdk($type); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); $url = $this->authManager->getAuthenticationUrl($type); return new TrustedRedirectResponse($url); }
php
protected function getRedirectResponse($type) { $sdk = $this->getSdk($type); if ($sdk instanceof RedirectResponse) { return $sdk; } $this->authManager->setSdk($sdk); $url = $this->authManager->getAuthenticationUrl($type); return new TrustedRedirectResponse($url); }
[ "protected", "function", "getRedirectResponse", "(", "$", "type", ")", "{", "$", "sdk", "=", "$", "this", "->", "getSdk", "(", "$", "type", ")", ";", "if", "(", "$", "sdk", "instanceof", "RedirectResponse", ")", "{", "return", "$", "sdk", ";", "}", "...
Returns the redirect response. @param string $type Type of action, "login" or "register". @return \Drupal\Core\Routing\TrustedRedirectResponse|\Symfony\Component\HttpFoundation\RedirectResponse Returns a RedirectResponse.
[ "Returns", "the", "redirect", "response", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php#L56-L67
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php
LinkedInAuthController.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 LinkedIn. @return \Symfony\Component\HttpFoundation\RedirectResponse Returns a RedirectResponse.
[ "Authorizes", "the", "user", "after", "redirect", "from", "LinkedIn", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php#L84-L122
goalgorilla/open_social
modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php
LinkedInAuthController.getProfile
public function getProfile($type) { // Get the OAuth token from LinkedIn. if (!$access_token = $this->authManager->getAccessToken($type)) { drupal_set_message($this->t('@network login failed. Token is not valid.', [ '@network' => $this->t('LinkedIn'), ]), 'error'); return $this->redire...
php
public function getProfile($type) { // Get the OAuth token from LinkedIn. if (!$access_token = $this->authManager->getAccessToken($type)) { drupal_set_message($this->t('@network login failed. Token is not valid.', [ '@network' => $this->t('LinkedIn'), ]), 'error'); return $this->redire...
[ "public", "function", "getProfile", "(", "$", "type", ")", "{", "// Get the OAuth token from LinkedIn.", "if", "(", "!", "$", "access_token", "=", "$", "this", "->", "authManager", "->", "getAccessToken", "(", "$", "type", ")", ")", "{", "drupal_set_message", ...
Loads access token, then loads profile. @param string $type The type. @return object Returns an object.
[ "Loads", "access", "token", "then", "loads", "profile", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_auth_linkedin/src/Controller/LinkedInAuthController.php#L230-L250
goalgorilla/open_social
modules/custom/social_demo/src/DemoFile.php
DemoFile.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("File 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("File 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/DemoFile.php#L61-L105
goalgorilla/open_social
modules/custom/social_demo/src/DemoFile.php
DemoFile.applyCrops
protected function applyCrops(array $item, FileInterface $entity) { // Add coordinates for cropping images. foreach ($item['crops'] as $crop_name => $data) { $crop_type = $this->entityTypeManager ->getStorage('crop_type') ->load($crop_name); if (!empty($crop_type) && $crop_type inst...
php
protected function applyCrops(array $item, FileInterface $entity) { // Add coordinates for cropping images. foreach ($item['crops'] as $crop_name => $data) { $crop_type = $this->entityTypeManager ->getStorage('crop_type') ->load($crop_name); if (!empty($crop_type) && $crop_type inst...
[ "protected", "function", "applyCrops", "(", "array", "$", "item", ",", "FileInterface", "$", "entity", ")", "{", "// Add coordinates for cropping images.", "foreach", "(", "$", "item", "[", "'crops'", "]", "as", "$", "crop_name", "=>", "$", "data", ")", "{", ...
Crops the images. @param array $item The array with items. @param \Drupal\file\FileInterface $entity The FileInterface entity.
[ "Crops", "the", "images", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/DemoFile.php#L130-L144
goalgorilla/open_social
modules/social_features/social_group/src/EventSubscriber/RedirectSubscriber.php
RedirectSubscriber.checkForRedirection
public function checkForRedirection(GetResponseEvent $event) { // Check if there is a group object on the current route. $group = _social_group_get_current_group(); // Get the current route name for the checks being performed below. $routeMatch = \Drupal::routeMatch()->getRouteName(); // Get the cur...
php
public function checkForRedirection(GetResponseEvent $event) { // Check if there is a group object on the current route. $group = _social_group_get_current_group(); // Get the current route name for the checks being performed below. $routeMatch = \Drupal::routeMatch()->getRouteName(); // Get the cur...
[ "public", "function", "checkForRedirection", "(", "GetResponseEvent", "$", "event", ")", "{", "// Check if there is a group object on the current route.", "$", "group", "=", "_social_group_get_current_group", "(", ")", ";", "// Get the current route name for the checks being perfor...
This method is called when the KernelEvents::REQUEST event is dispatched. @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event The event.
[ "This", "method", "is", "called", "when", "the", "KernelEvents", "::", "REQUEST", "event", "is", "dispatched", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/EventSubscriber/RedirectSubscriber.php#L35-L62
goalgorilla/open_social
modules/custom/activity_basics/src/Plugin/ActivityContext/GroupActivityContext.php
GroupActivityContext.getRecipients
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = $data['related_object']['0']; // TODO: Replace this with d...
php
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $referenced_entity = $data['related_object']['0']; // TODO: Replace this with d...
[ "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/GroupActivityContext.php#L21-L42
goalgorilla/open_social
modules/custom/mentions/src/MentionsAccessControlHandler.php
MentionsAccessControlHandler.checkAccess
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_event\EventEnrollmentInterface $entity */ switch ($operation) { case 'view': // @TODO: Add some permissions. return AccessResult::allowed(); } // Unknown operat...
php
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { /** @var \Drupal\social_event\EventEnrollmentInterface $entity */ switch ($operation) { case 'view': // @TODO: Add some permissions. return AccessResult::allowed(); } // Unknown operat...
[ "protected", "function", "checkAccess", "(", "EntityInterface", "$", "entity", ",", "$", "operation", ",", "AccountInterface", "$", "account", ")", "{", "/** @var \\Drupal\\social_event\\EventEnrollmentInterface $entity */", "switch", "(", "$", "operation", ")", "{", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/mentions/src/MentionsAccessControlHandler.php#L20-L30
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/Page.php
Page.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['image'])) { $entry['field_page_image'] = $this->prepareImage($item['image'], $item['image_a...
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['image'])) { $entry['field_page_image'] = $this->prepareImage($item['image'], $item['image_a...
[ "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/Page.php#L58-L74
goalgorilla/open_social
modules/custom/social_demo/src/Plugin/DemoContent/EventType.php
EventType.count
public function count() { // Check if event types are enabled. if (!\Drupal::moduleHandler()->moduleExists('social_event_type')) { drush_log(dt('The social event type module is not enabled.'), LogLevel::WARNING); return FALSE; } return parent::count(); }
php
public function count() { // Check if event types are enabled. if (!\Drupal::moduleHandler()->moduleExists('social_event_type')) { drush_log(dt('The social event type module is not enabled.'), LogLevel::WARNING); return FALSE; } return parent::count(); }
[ "public", "function", "count", "(", ")", "{", "// Check if event types are enabled.", "if", "(", "!", "\\", "Drupal", "::", "moduleHandler", "(", ")", "->", "moduleExists", "(", "'social_event_type'", ")", ")", "{", "drush_log", "(", "dt", "(", "'The social even...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/social_demo/src/Plugin/DemoContent/EventType.php#L35-L43
goalgorilla/open_social
modules/social_features/social_group/src/Element/SocialGroupEntityAutocomplete.php
SocialGroupEntityAutocomplete.validateEntityAutocomplete
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { $duplicated_values = $value = []; // Load the current Group so we can see if there are existing members. $group = _social_group_get_current_group(); // Grab all the input values ...
php
public static function validateEntityAutocomplete(array &$element, FormStateInterface $form_state, array &$complete_form) { $duplicated_values = $value = []; // Load the current Group so we can see if there are existing members. $group = _social_group_get_current_group(); // Grab all the input values ...
[ "public", "static", "function", "validateEntityAutocomplete", "(", "array", "&", "$", "element", ",", "FormStateInterface", "$", "form_state", ",", "array", "&", "$", "complete_form", ")", "{", "$", "duplicated_values", "=", "$", "value", "=", "[", "]", ";", ...
Form element validation handler for entity_autocomplete elements.
[ "Form", "element", "validation", "handler", "for", "entity_autocomplete", "elements", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_group/src/Element/SocialGroupEntityAutocomplete.php#L24-L90
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.propertyDefinitions
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { $properties['value'] = DataDefinition::create('string') ->setLabel(t('Text value')) ->addConstraint('Length', ['max' => 255]) ->setRequired(TRUE); return $properties; }
php
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) { $properties['value'] = DataDefinition::create('string') ->setLabel(t('Text value')) ->addConstraint('Length', ['max' => 255]) ->setRequired(TRUE); return $properties; }
[ "public", "static", "function", "propertyDefinitions", "(", "FieldStorageDefinitionInterface", "$", "field_definition", ")", "{", "$", "properties", "[", "'value'", "]", "=", "DataDefinition", "::", "create", "(", "'string'", ")", "->", "setLabel", "(", "t", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L36-L43
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.storageSettingsForm
public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) { $allowed_values = $this->getSetting('allowed_values'); $element['allowed_values'] = [ '#type' => 'textarea', '#title' => t('Allowed values list'), '#default_value' => $this->allowedValuesString($all...
php
public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) { $allowed_values = $this->getSetting('allowed_values'); $element['allowed_values'] = [ '#type' => 'textarea', '#title' => t('Allowed values list'), '#default_value' => $this->allowedValuesString($all...
[ "public", "function", "storageSettingsForm", "(", "array", "&", "$", "form", ",", "FormStateInterface", "$", "form_state", ",", "$", "has_data", ")", "{", "$", "allowed_values", "=", "$", "this", "->", "getSetting", "(", "'allowed_values'", ")", ";", "$", "e...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L65-L84
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.validateAllowedValues
public static function validateAllowedValues(array $element, FormStateInterface $form_state) { $values = static::extractAllowedValues($element['#value'], $element['#field_has_data']); if (!is_array($values)) { $form_state->setError($element, t('Allowed values list: invalid input.')); } else { ...
php
public static function validateAllowedValues(array $element, FormStateInterface $form_state) { $values = static::extractAllowedValues($element['#value'], $element['#field_has_data']); if (!is_array($values)) { $form_state->setError($element, t('Allowed values list: invalid input.')); } else { ...
[ "public", "static", "function", "validateAllowedValues", "(", "array", "$", "element", ",", "FormStateInterface", "$", "form_state", ")", "{", "$", "values", "=", "static", "::", "extractAllowedValues", "(", "$", "element", "[", "'#value'", "]", ",", "$", "ele...
Element_validate callback for options field allowed values. @param array $element An associative array containing the properties and children of the generic form element. @param \Drupal\Core\Form\FormStateInterface $form_state The current state of the form for the form this element belongs to. @see \Drupal\Core\Rende...
[ "Element_validate", "callback", "for", "options", "field", "allowed", "values", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L97-L122
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.isEmpty
public function isEmpty() { // We're empty if we have no value set, // or we have a value that's neither a string nor an integer. return !isset($this->values['value']) || (!is_int($this->values['value']) && !is_string($this->values['value'])); }
php
public function isEmpty() { // We're empty if we have no value set, // or we have a value that's neither a string nor an integer. return !isset($this->values['value']) || (!is_int($this->values['value']) && !is_string($this->values['value'])); }
[ "public", "function", "isEmpty", "(", ")", "{", "// We're empty if we have no value set,", "// or we have a value that's neither a string nor an integer.", "return", "!", "isset", "(", "$", "this", "->", "values", "[", "'value'", "]", ")", "||", "(", "!", "is_int", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L127-L131
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.allowedValuesString
protected function allowedValuesString(array $values) { $lines = []; foreach ($values as $key => $value) { if (is_array($value)) { $lines[$key] = implode("|", $value);; } } return implode("\n", $lines); }
php
protected function allowedValuesString(array $values) { $lines = []; foreach ($values as $key => $value) { if (is_array($value)) { $lines[$key] = implode("|", $value);; } } return implode("\n", $lines); }
[ "protected", "function", "allowedValuesString", "(", "array", "$", "values", ")", "{", "$", "lines", "=", "[", "]", ";", "foreach", "(", "$", "values", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", "...
Generates a string representation of an array of 'allowed values'. This string format is suitable for edition in a textarea. @param array $values An array of values, where array keys are values and array values are labels. @return string The string representation of the $values array: - Values are separated by a car...
[ "Generates", "a", "string", "representation", "of", "an", "array", "of", "allowed", "values", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L147-L155
goalgorilla/open_social
modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php
Dropdown.extractAllowedValues
protected static function extractAllowedValues($string, $has_data) { $values = []; $list = explode("\n", $string); $list = array_map('trim', $list); $list = array_filter($list, 'strlen'); foreach ($list as $position => $text) { // Check for an explicit key. $matches = []; // @TOD...
php
protected static function extractAllowedValues($string, $has_data) { $values = []; $list = explode("\n", $string); $list = array_map('trim', $list); $list = array_filter($list, 'strlen'); foreach ($list as $position => $text) { // Check for an explicit key. $matches = []; // @TOD...
[ "protected", "static", "function", "extractAllowedValues", "(", "$", "string", ",", "$", "has_data", ")", "{", "$", "values", "=", "[", "]", ";", "$", "list", "=", "explode", "(", "\"\\n\"", ",", "$", "string", ")", ";", "$", "list", "=", "array_map", ...
Extracts the allowed values array from the allowed_values element. @param string $string The raw string to extract values from. @param bool $has_data The current field already has data inserted or not. @return array|null The array of extracted key/value pairs, or NULL if the string is invalid. @see \Drupal\options\P...
[ "Extracts", "the", "allowed", "values", "array", "from", "the", "allowed_values", "element", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/dropdown/src/Plugin/Field/FieldType/Dropdown.php#L170-L205
goalgorilla/open_social
modules/custom/activity_logger/src/Plugin/QueueWorker/MessageQueueCreator.php
MessageQueueCreator.processItem
public function processItem($data) { // First make sure it's an actual entity. if ($entity = Node::load($data['entity_id'])) { // Check if it's created more than 20 seconds ago. $timestamp = $entity->getCreatedTime(); // Current time. $now = time(); $diff = abs($now - $timestamp);...
php
public function processItem($data) { // First make sure it's an actual entity. if ($entity = Node::load($data['entity_id'])) { // Check if it's created more than 20 seconds ago. $timestamp = $entity->getCreatedTime(); // Current time. $now = time(); $diff = abs($now - $timestamp);...
[ "public", "function", "processItem", "(", "$", "data", ")", "{", "// First make sure it's an actual entity.", "if", "(", "$", "entity", "=", "Node", "::", "load", "(", "$", "data", "[", "'entity_id'", "]", ")", ")", "{", "// Check if it's created more than 20 seco...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_logger/src/Plugin/QueueWorker/MessageQueueCreator.php#L23-L48
goalgorilla/open_social
modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php
VoteActivityContext.getRecipients
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $related_object = $data['related_object'][0]; if ($related_object['target_type'] =...
php
public function getRecipients(array $data, $last_uid, $limit) { $recipients = []; // We only know the context if there is a related object. if (isset($data['related_object']) && !empty($data['related_object'])) { $related_object = $data['related_object'][0]; if ($related_object['target_type'] =...
[ "public", "function", "getRecipients", "(", "array", "$", "data", ",", "$", "last_uid", ",", "$", "limit", ")", "{", "$", "recipients", "=", "[", "]", ";", "// We only know the context if there is a related object.", "if", "(", "isset", "(", "$", "data", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php#L21-L48
goalgorilla/open_social
modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/UserExportPlugin/EnrolmentUserRegistration.php
EnrolmentUserRegistration.getValue
public function getValue(UserInterface $entity) { if ($entity->isAnonymous()) { $entity = &$this->configuration['entity']; } return $this->format($entity); }
php
public function getValue(UserInterface $entity) { if ($entity->isAnonymous()) { $entity = &$this->configuration['entity']; } return $this->format($entity); }
[ "public", "function", "getValue", "(", "UserInterface", "$", "entity", ")", "{", "if", "(", "$", "entity", "->", "isAnonymous", "(", ")", ")", "{", "$", "entity", "=", "&", "$", "this", "->", "configuration", "[", "'entity'", "]", ";", "}", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/UserExportPlugin/EnrolmentUserRegistration.php#L22-L28
goalgorilla/open_social
modules/custom/activity_send/modules/activity_send_email/src/EmailFrequencyBase.php
EmailFrequencyBase.processItem
public function processItem(Activity $activity, Message $message, User $target) { $db = Database::getConnection(); // Insert incoming activities in our digest table. $db->insert('user_activity_digest') ->fields([ 'uid', 'activity', 'frequency', 'timestamp', ]) ...
php
public function processItem(Activity $activity, Message $message, User $target) { $db = Database::getConnection(); // Insert incoming activities in our digest table. $db->insert('user_activity_digest') ->fields([ 'uid', 'activity', 'frequency', 'timestamp', ]) ...
[ "public", "function", "processItem", "(", "Activity", "$", "activity", ",", "Message", "$", "message", ",", "User", "$", "target", ")", "{", "$", "db", "=", "Database", "::", "getConnection", "(", ")", ";", "// Insert incoming activities in our digest table.", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_send/modules/activity_send_email/src/EmailFrequencyBase.php#L42-L60
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.buildActivities
protected function buildActivities(array $data) { $activities = []; $message = Message::load($data['mid']); // Initialize fields for new activity entity. $activity_fields = [ 'created' => $this->getCreated($message), 'field_activity_destinations' => $this->getFieldDestinations($data), ...
php
protected function buildActivities(array $data) { $activities = []; $message = Message::load($data['mid']); // Initialize fields for new activity entity. $activity_fields = [ 'created' => $this->getCreated($message), 'field_activity_destinations' => $this->getFieldDestinations($data), ...
[ "protected", "function", "buildActivities", "(", "array", "$", "data", ")", "{", "$", "activities", "=", "[", "]", ";", "$", "message", "=", "Message", "::", "load", "(", "$", "data", "[", "'mid'", "]", ")", ";", "// Initialize fields for new activity entity...
Build the activities based on a data array. @param array $data An array of data to create activity from. @return array An array of created activities.
[ "Build", "the", "activities", "based", "on", "a", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L60-L89
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getFieldDestinations
protected function getFieldDestinations(array $data, $allowed_destinations = []) { $value = NULL; if (isset($data['destination'])) { $value = $data['destination']; if (!empty($allowed_destinations)) { foreach ($value as $key => $destination) { if (!in_array($destination['value'], $...
php
protected function getFieldDestinations(array $data, $allowed_destinations = []) { $value = NULL; if (isset($data['destination'])) { $value = $data['destination']; if (!empty($allowed_destinations)) { foreach ($value as $key => $destination) { if (!in_array($destination['value'], $...
[ "protected", "function", "getFieldDestinations", "(", "array", "$", "data", ",", "$", "allowed_destinations", "=", "[", "]", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "data", "[", "'destination'", "]", ")", ")", "{", "$", ...
Get field value for 'destination' field from data array.
[ "Get", "field", "value", "for", "destination", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L94-L107
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getFieldMessage
protected function getFieldMessage($data) { $value = NULL; if (isset($data['mid'])) { $value = []; $value[] = [ 'target_id' => $data['mid'], ]; } return $value; }
php
protected function getFieldMessage($data) { $value = NULL; if (isset($data['mid'])) { $value = []; $value[] = [ 'target_id' => $data['mid'], ]; } return $value; }
[ "protected", "function", "getFieldMessage", "(", "$", "data", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "data", "[", "'mid'", "]", ")", ")", "{", "$", "value", "=", "[", "]", ";", "$", "value", "[", "]", "=", "[", ...
Get field value for 'message' field from data array.
[ "Get", "field", "value", "for", "message", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L123-L132
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getFieldOutputText
protected function getFieldOutputText(Message $message, $arguments = []) { $value = NULL; if (isset($message)) { $value = $this->getMessageText($message); // Text for aggregated activities. if (!empty($value[1]) && !empty($arguments)) { $text = str_replace('@count', $arguments['@coun...
php
protected function getFieldOutputText(Message $message, $arguments = []) { $value = NULL; if (isset($message)) { $value = $this->getMessageText($message); // Text for aggregated activities. if (!empty($value[1]) && !empty($arguments)) { $text = str_replace('@count', $arguments['@coun...
[ "protected", "function", "getFieldOutputText", "(", "Message", "$", "message", ",", "$", "arguments", "=", "[", "]", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "message", ")", ")", "{", "$", "value", "=", "$", "this", "...
Get field value for 'output_text' field from data array.
[ "Get", "field", "value", "for", "output_text", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L137-L162
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getCreated
protected function getCreated(Message $message) { $value = NULL; if (isset($message)) { $value = $message->getCreatedTime(); } return $value; }
php
protected function getCreated(Message $message) { $value = NULL; if (isset($message)) { $value = $message->getCreatedTime(); } return $value; }
[ "protected", "function", "getCreated", "(", "Message", "$", "message", ")", "{", "$", "value", "=", "NULL", ";", "if", "(", "isset", "(", "$", "message", ")", ")", "{", "$", "value", "=", "$", "message", "->", "getCreatedTime", "(", ")", ";", "}", ...
Get field value for 'created' field from data array.
[ "Get", "field", "value", "for", "created", "field", "from", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L167-L173
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.buildAggregatedActivites
protected function buildAggregatedActivites($data, $activity_fields) { $activities = []; $common_destinations = $this->activityDestinationManager->getListByProperties('isCommon', TRUE); $personal_destinations = $this->activityDestinationManager->getListByProperties('isCommon', FALSE); // Get related ac...
php
protected function buildAggregatedActivites($data, $activity_fields) { $activities = []; $common_destinations = $this->activityDestinationManager->getListByProperties('isCommon', TRUE); $personal_destinations = $this->activityDestinationManager->getListByProperties('isCommon', FALSE); // Get related ac...
[ "protected", "function", "buildAggregatedActivites", "(", "$", "data", ",", "$", "activity_fields", ")", "{", "$", "activities", "=", "[", "]", ";", "$", "common_destinations", "=", "$", "this", "->", "activityDestinationManager", "->", "getListByProperties", "(",...
Build the aggregated activities based on a data array.
[ "Build", "the", "aggregated", "activities", "based", "on", "a", "data", "array", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L186-L235
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getAggregationRelatedActivities
protected function getAggregationRelatedActivities($data) { $activities = []; $related_object = $data['related_object'][0]; if (!empty($related_object['target_id']) && !empty($related_object['target_type'])) { if ($related_object['target_type'] === 'comment') { // Get commented entity. ...
php
protected function getAggregationRelatedActivities($data) { $activities = []; $related_object = $data['related_object'][0]; if (!empty($related_object['target_id']) && !empty($related_object['target_type'])) { if ($related_object['target_type'] === 'comment') { // Get commented entity. ...
[ "protected", "function", "getAggregationRelatedActivities", "(", "$", "data", ")", "{", "$", "activities", "=", "[", "]", ";", "$", "related_object", "=", "$", "data", "[", "'related_object'", "]", "[", "0", "]", ";", "if", "(", "!", "empty", "(", "$", ...
Get related activities for activity aggregation.
[ "Get", "related", "activities", "for", "activity", "aggregation", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L240-L271
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getActivityRelatedEntity
public static function getActivityRelatedEntity($data) { $related_object = $data['related_object'][0]; // We return parent comment as related object as comment // for create_comment_reply messages. if ($data['message_template'] === 'create_comment_reply') { $comment_storage = \Drupal::entityTypeM...
php
public static function getActivityRelatedEntity($data) { $related_object = $data['related_object'][0]; // We return parent comment as related object as comment // for create_comment_reply messages. if ($data['message_template'] === 'create_comment_reply') { $comment_storage = \Drupal::entityTypeM...
[ "public", "static", "function", "getActivityRelatedEntity", "(", "$", "data", ")", "{", "$", "related_object", "=", "$", "data", "[", "'related_object'", "]", "[", "0", "]", ";", "// We return parent comment as related object as comment", "// for create_comment_reply mess...
Get related entity for activity aggregation.
[ "Get", "related", "entity", "for", "activity", "aggregation", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L276-L324
goalgorilla/open_social
modules/custom/activity_creator/src/ActivityFactory.php
ActivityFactory.getAggregationAuthorsCount
protected function getAggregationAuthorsCount(array $data) { $count = 0; $related_object = $data['related_object'][0]; if (isset($related_object['target_type']) && $related_object['target_type'] === 'comment') { // Get related entity. $related_entity = $this->getActivityRelatedEntity($data); ...
php
protected function getAggregationAuthorsCount(array $data) { $count = 0; $related_object = $data['related_object'][0]; if (isset($related_object['target_type']) && $related_object['target_type'] === 'comment') { // Get related entity. $related_entity = $this->getActivityRelatedEntity($data); ...
[ "protected", "function", "getAggregationAuthorsCount", "(", "array", "$", "data", ")", "{", "$", "count", "=", "0", ";", "$", "related_object", "=", "$", "data", "[", "'related_object'", "]", "[", "0", "]", ";", "if", "(", "isset", "(", "$", "related_obj...
Get unique authors number for activity aggregation.
[ "Get", "unique", "authors", "number", "for", "activity", "aggregation", "." ]
train
https://github.com/goalgorilla/open_social/blob/4f7517dc4bfa45f8590289d2907e06ac8f28e378/modules/custom/activity_creator/src/ActivityFactory.php#L329-L345