not show. */ public function __construct(array $disabled = array()) { foreach ($this->getSupportedTypes() as $type => $tabConfig) { if (!in_array($type, $disabled)) { $tabConfig['url'] = Url::fromRequest(); $tab = new Tab($tabConfig); $tab->setTargetBlank(); $this->tabs[] = $tab; } } } /** * Applies the format selectio to the provided tabset * * @param Tabs $tabs The tabs object to extend with * * @see Tabextension::apply() */ public function apply(Tabs $tabs) { foreach ($this->tabs as $tab) { $tabs->addAsDropdown($tab->getName(), $tab); } } /** * Return an array containing the tab definitions for all supported types * * Using array_keys on this array or isset allows to check whether a * requested type is supported * * @return array */ public function getSupportedTypes() { $supportedTypes = array(); if (Platform::extensionLoaded('gd')) { $supportedTypes[self::TYPE_PDF] = array( 'name' => 'pdf', 'label' => 'PDF', 'icon' => 'file-pdf', 'urlParams' => array('format' => 'pdf'), ); } $supportedTypes[self::TYPE_CSV] = array( 'name' => 'csv', 'label' => 'CSV', 'icon' => 'file-excel', 'urlParams' => array('format' => 'csv') ); if (Platform::extensionLoaded('json')) { $supportedTypes[self::TYPE_JSON] = array( 'name' => 'json', 'label' => 'JSON', 'icon' => 'img/icons/json.png', 'urlParams' => array('format' => 'json') ); } return $supportedTypes; } }