Skip to content

Instantly share code, notes, and snippets.

@shadcn
Created May 12, 2020 18:25
Show Gist options
  • Select an option

  • Save shadcn/f9e1ad24b7f630a94fc5ace6b53d7229 to your computer and use it in GitHub Desktop.

Select an option

Save shadcn/f9e1ad24b7f630a94fc5ace6b53d7229 to your computer and use it in GitHub Desktop.

Revisions

  1. shadcn created this gist May 12, 2020.
    23 changes: 23 additions & 0 deletions PurchasedPlanListBuilder.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?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;
    }

    }
    13 changes: 13 additions & 0 deletions custom_module.module
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    <?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);
    }