Skip to content

Instantly share code, notes, and snippets.

@shadcn
Created May 12, 2020 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadcn/f9e1ad24b7f630a94fc5ace6b53d7229 to your computer and use it in GitHub Desktop.
Save shadcn/f9e1ad24b7f630a94fc5ace6b53d7229 to your computer and use it in GitHub Desktop.
How to override the PurchasedPlanListBuilder for Apigee M10n
<?php
// Place in `custom_module/custom_module.module`
use Drupal\custom_module\Entity\ListBuilder\PurchasedPlanListBuilder;
/**
* Implements hook_entity_type_alter().
*/
function custom_module_entity_type_alter(array &$entity_types) {
// Set the list builder to use the custom one we implemented.
$entity_types['purchased_plan']->setListBuilderClass(PurchasedPlanListBuilder::class);
}
<?php
// Place in `custom_module/src/Entity/ListBuilder/PurchasedPlanListBuilder.php`
namespace Drupal\custom_module\Entity\ListBuilder;
use Drupal\apigee_m10n\Entity\ListBuilder\PurchasedPlanListBuilder as ApigeePurchasedPlanListBuilder;
class PurchasedPlanListBuilder extends ApigeePurchasedPlanListBuilder {
/**
* {@inheritdoc}
*/
public function render() {
$build = parent::render()
// Do your own thing here.
// You can inspect $build and change things.
return $build;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment