public function AggregatorCategoryBlock::getDerivativeDefinition

Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinition().

Overrides DerivativeInterface::getDerivativeDefinition

File

drupal/core/modules/aggregator/lib/Drupal/aggregator/Plugin/Derivative/AggregatorCategoryBlock.php, line 29
Contains \Drupal\aggregator\Plugin\Derivative\AggregatorCategoryBlock.

Class

AggregatorCategoryBlock
Provides block plugin definitions for aggregator categories.

Namespace

Drupal\aggregator\Plugin\Derivative

Code

public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
  if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
    return $this->derivatives[$derivative_id];
  }
  $result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title WHERE cid = :cid', array(
    ':cid' => $derivative_id,
  ))
    ->fetchObject();
  $this->derivatives[$derivative_id] = $base_plugin_definition;
  $this->derivatives[$derivative_id]['delta'] = $result->cid;
  $this->derivatives[$derivative_id]['admin_label'] = t('@title category latest items', array(
    '@title' => $result->title,
  ));
  return $this->derivatives[$derivative_id];
}