Comments

DrupalGideon created an issue. See original summary.

drupalgideon’s picture

StatusFileSize
new5.29 KB

This seemed too easy!

rh_group.module


/**
 * @file
 * Contains rh_group.module.
 */

use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Implements hook_entity_base_field_info().
 */
function rh_media_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type->id() == 'group') {
    return \Drupal::service('rabbit_hole.entity_extender')
      ->getRabbitHoleFields('group');
  }
}

rh_group.info.yml

name: Rabbit Hole group entity
type: module
description: Adds Rabbit Hole functionality for Group entity.
core: 8.x
dependencies:
  - rabbit_hole
  - group

src/Plugin/RabbitHoleEntityPlugin/Group.php


namespace Drupal\rh_group\Plugin\RabbitHoleEntityPlugin;

use Drupal\rabbit_hole\Plugin\RabbitHoleEntityPluginBase;

/**
 * Implements rabbit hole behavior for Group.
 *
 * @RabbitHoleEntityPlugin(
 *   id = "rh_group",
 *   label = @Translation("Group"),
 *   entityType = "group"
 * )
 */
class Group extends RabbitHoleEntityPluginBase {

}

drupalgideon’s picture

Status: Active » Needs review
StatusFileSize
new2.25 KB
drupalgideon’s picture

Category: Support request » Feature request
imyaro’s picture

Status: Needs review » Needs work

Why do this module has to have dependency from the "group" module?
It seems meanless.
It will be great if you will add a support, but support through depencency for so big and popular module is bad idea.

dylan donkersgoed’s picture

Status: Needs work » Fixed
StatusFileSize
new2.18 KB
new1.02 KB

It's just a submodule so I think having group as a dependency is fine and makes sense. I think if group wasn't enabled along with this module nothing *bad* would actually happen (it just wouldn't do anything) but it wouldn't be very intuitive.

I made two minor changes:
- I changed the human readable name and description to just refer to "group" rather than "group entity". I think that just came from it being copied from the media_entity module, but that's just because the actual module name has it. It's not necessary in most cases.
- I fixed the hook in the rh_group.module file to begin with rh_group rather than rh_media - this probably would've caused some issues with per-entity overrides

Aside from that this looks good. I'll merge it into dev now and it'll be in the next beta release. Thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.