Commit 6356f929 authored by Derek Wright's avatar Derek Wright
Browse files

Issue #2813405: Fix comment #118 points 1-5, 8-10.

parent c34f0ed5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
name: 'Group Content Field'
description: 'Provide a new field which allows you to add group content from entity form'
description: 'Defines a group content field type.'
package: 'Group'
type: 'module'
version: 1.0
core: '8.x'
dependencies:
  - 'group:group'
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ function gcontent_field_entity_base_field_info(EntityTypeInterface $entity_type)
}

/**
 * Get entities where the field should be added.
 * Get entities that should have a group content field.
 */
function gcontent_field_get_entity_types() {
  $entity_types = [];
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\Element\EntityAutocomplete;

/**
 * Provides an group autocomplete form element.
 * Provides a group autocomplete form element.
 *
 * The #default_value accepted by this element is either an entity object or an
 * array of entity objects.
@@ -37,7 +37,7 @@ class GroupAutocomplete extends EntityAutocomplete {
    elseif (count($groups) > 5) {
      $params['@id'] = key($groups);
      // Error if there are more than 5 matching groups.
      $form_state->setError($element, t('Many groups are called %value. Specify the one you want by appending the id in parentheses, like "@value (@id)".', $params));
      $form_state->setError($element, t('Many groups are called %value. Pick one by appending the ID in parentheses, like "@value (@id)".', $params));
    }
    elseif (count($groups) > 1) {
      // More helpful error if there are only a few matching groups.
@@ -46,7 +46,7 @@ class GroupAutocomplete extends EntityAutocomplete {
        $multiples[] = $name . ' (' . $id . ')';
      }
      $params['@id'] = $id;
      $form_state->setError($element, t('Multiple groups match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', ['%multiple' => implode('", "', $multiples)] + $params));
      $form_state->setError($element, t('Multiple groups match: "%multiple". Pick one by appending the ID in parentheses, like "@value (@id)".', ['%multiple' => implode('", "', $multiples)] + $params));
    }
    else {
      // Take the one and only matching entity.
+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.