Skip to content

Instantly share code, notes, and snippets.

@weitzman
Created November 17, 2021 16:44
Show Gist options
  • Save weitzman/689882efc1bbec7aa9155e53724603b8 to your computer and use it in GitHub Desktop.
Save weitzman/689882efc1bbec7aa9155e53724603b8 to your computer and use it in GitHub Desktop.
Bundle classes generated by Drush
<?php
namespace Drupal\drush_empty_module\Bundle\node;
/**
* A bundle class for node entities.
*/
class Article extends NodeBundleBase {
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
/**
* A bundle class for media entities.
*/
class Audio extends MediaBundleBase {
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
/**
* A bundle class for media entities.
*/
class Document extends MediaBundleBase {
}
<?php
/**
* @file
* Primary module hooks for drush_empty_module module.
*/
/**
* Implements hook_entity_bundle_info_alter().
*/
function drush_empty_module_entity_bundle_info_alter(array &$bundles): void {
$bundles['node']['article']['class'] = \Drupal\drush_empty_module\Bundle\node\Article::class;
$bundles['node']['page']['class'] = \Drupal\drush_empty_module\Bundle\node\Page::class;
$bundles['media']['audio']['class'] = \Drupal\drush_empty_module\Bundle\media\Audio::class;
$bundles['media']['document']['class'] = \Drupal\drush_empty_module\Bundle\media\Document::class;
$bundles['media']['image']['class'] = \Drupal\drush_empty_module\Bundle\media\Image::class;
$bundles['media']['remote_video']['class'] = \Drupal\drush_empty_module\Bundle\media\RemoteVideo::class;
$bundles['media']['video']['class'] = \Drupal\drush_empty_module\Bundle\media\Video::class;
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
/**
* A bundle class for media entities.
*/
class Image extends MediaBundleBase {
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
use Drupal\media\Entity\Media;
/**
* A base bundle class for media entities.
*/
abstract class MediaBundleBase extends Media {
}
<?php
namespace Drupal\drush_empty_module\Bundle\node;
use Drupal\node\Entity\Node;
/**
* A base bundle class for node entities.
*/
abstract class NodeBundleBase extends Node {
}
<?php
namespace Drupal\drush_empty_module\Bundle\node;
/**
* A bundle class for node entities.
*/
class Page extends NodeBundleBase {
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
/**
* A bundle class for media entities.
*/
class RemoteVideo extends MediaBundleBase {
}
<?php
namespace Drupal\drush_empty_module\Bundle\media;
/**
* A bundle class for media entities.
*/
class Video extends MediaBundleBase {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment