Created
May 12, 2020 18:25
-
-
Save shadcn/f9e1ad24b7f630a94fc5ace6b53d7229 to your computer and use it in GitHub Desktop.
How to override the PurchasedPlanListBuilder for Apigee M10n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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