You are here

TabPluginCollection.php in Block Tabs 8

Namespace

Drupal\blocktabs

File

src/TabPluginCollection.php
View source
<?php

namespace Drupal\blocktabs;

use Drupal\Core\Plugin\DefaultLazyPluginCollection;

/**
 * A collection of tabs.
 */
class TabPluginCollection extends DefaultLazyPluginCollection {

  /**
   * {@inheritdoc}
   *
   * @return \Drupal\blocktabs\TabInterface
   */
  public function &get($instance_id) {
    return parent::get($instance_id);
  }

  /**
   * {@inheritdoc}
   */
  public function sortHelper($aID, $bID) {
    $a_weight = $this
      ->get($aID)
      ->getWeight();
    $b_weight = $this
      ->get($bID)
      ->getWeight();
    if ($a_weight == $b_weight) {
      return 0;
    }
    return $a_weight < $b_weight ? -1 : 1;
  }

}

Classes

Namesort descending Description
TabPluginCollection A collection of tabs.