Same name in other branches
- 4.x src/Entity/QuickTabsInstance.php \Drupal\quicktabs\Entity\QuickTabsInstance
Defines the QuickTabsInstance entity.
The QuickTabsInstnace entity stores information about a quicktab.
Plugin annotation
@ConfigEntityType(
id = "quicktabs_instance",
label = @Translation("Quick Tabs"),
module = "quicktabs",
handlers = {
"list_builder" = "Drupal\quicktabs\QuickTabsInstanceListBuilder",
"form" = {
"add" = "Drupal\quicktabs\Form\QuickTabsInstanceEditForm",
"edit" = "Drupal\quicktabs\Form\QuickTabsInstanceEditForm",
"delete" = "Drupal\quicktabs\Form\QuickTabsInstanceDeleteForm",
"duplicate" = "Drupal\quicktabs\Form\QuickTabsInstanceDuplicateForm",
},
},
config_prefix = "quicktabs_instance",
entity_keys = {
"id" = "id",
"label" = "label"
},
links = {
"edit" = "/admin/structure/quicktabs/{quicktabs_instance}/edit",
"add" = "/admin/structure/quicktabs/add",
"delete" = "/admin/structure/quicktabs/{quicktabs_instance}/delete",
"duplicate" = "/admin/structure/quicktabs/{quicktabs_instance}/duplicate"
},
config_export = {
"id" = "id",
"label" = "label",
"renderer" = "renderer",
"options" = "options",
"hide_empty_tabs" = "hide_empty_tabs",
"default_tab" = "default_tab",
"configuration_data" = "configuration_data"
},
admin_permission = "administer quicktabs",
)
Hierarchy
- class \Drupal\quicktabs\Entity\QuickTabsInstance extends \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\quicktabs\Entity\QuickTabsInstanceInterface
Expanded class hierarchy of QuickTabsInstance
7 files declare their use of QuickTabsInstance
- AccordionTabs.php dans quicktabs_accordion/
src/ Plugin/ TabRenderer/ AccordionTabs.php - QuickTabs.php dans src/
Plugin/ TabRenderer/ QuickTabs.php - QuicktabsConfigSchemaTest.php dans tests/
src/ Kernel/ QuicktabsConfigSchemaTest.php - QuickTabsInstanceEditForm.php dans src/
Form/ QuickTabsInstanceEditForm.php - TabRendererBase.php dans src/
TabRendererBase.php
Fichier
-
src/
Entity/ QuickTabsInstance.php, line 48
Namespace
Drupal\quicktabs\EntityView source
class QuickTabsInstance extends ConfigEntityBase implements QuickTabsInstanceInterface {
const QUICKTABS_DELTA_NONE = '9999';
/**
* The QuickTabs Instance ID.
*
* @var string
*/
protected $id;
/**
* The label of the QuickTabs Instance.
*
* @var string
*/
protected $label;
/**
* The renderer of the QuickTabs Instance.
*
* @var string
*/
protected $renderer;
/**
* Options provided by renderer plugins.
*
* @var array
*/
protected $options;
/**
* Whether or not to hide empty tabs.
*
* @var bool
*/
protected $hide_empty_tabs;
/**
* Whether or not to hide empty tabs.
*
* @var bool
*/
protected $default_tab;
/**
* Required to render this instance.
*
* @var array
*/
protected $configuration_data;
/**
* {@inheritdoc}
*/
public function getLabel() {
return $this->label;
}
/**
* {@inheritdoc}
*/
public function getRenderer() {
return $this->renderer;
}
/**
* {@inheritdoc}
*/
public function getOptions() : array {
if (empty($this->options)) {
return [];
}
return $this->options;
}
/**
* {@inheritdoc}
*/
public function getHideEmptyTabs() {
return $this->hide_empty_tabs;
}
/**
* {@inheritdoc}
*/
public function getDefaultTab() {
return $this->default_tab;
}
/**
* {@inheritdoc}
*/
public function getConfigurationData() {
return $this->configuration_data;
}
/**
* {@inheritdoc}
*/
public function setConfigurationData(array $configuration_data) {
$this->configuration_data = $configuration_data;
}
/**
* Returns a render array to be used in a block or page.
*
* @return array
* A render array.
*/
public function getRenderArray() {
$type = \Drupal::service('plugin.manager.tab_renderer');
$renderer = $type->createInstance($this->getRenderer());
\Drupal::moduleHandler()->alter('quicktabs_instance', $this);
return $renderer->render($this);
}
/**
* Loads a quicktabs_instance from configuration and returns it.
*
* @param string $id
* The qti ID to load.
*
* @return \Drupal\quicktabs\Entity\QuickTabsInstance
* The loaded entity.
*/
public static function getQuickTabsInstance($id) {
$qt = \Drupal::service('entity_type.manager')->getStorage('quicktabs_instance')
->load($id);
return $qt;
}
}
Members
Titre Trier par ordre décroissant | Modifiers | Object type | Résumé | Overriden Title |
---|---|---|---|---|
QuickTabsInstance::$configuration_data | protected | property | Required to render this instance. | |
QuickTabsInstance::$default_tab | protected | property | Whether or not to hide empty tabs. | |
QuickTabsInstance::$hide_empty_tabs | protected | property | Whether or not to hide empty tabs. | |
QuickTabsInstance::$id | protected | property | The QuickTabs Instance ID. | |
QuickTabsInstance::$label | protected | property | The label of the QuickTabs Instance. | |
QuickTabsInstance::$options | protected | property | Options provided by renderer plugins. | |
QuickTabsInstance::$renderer | protected | property | The renderer of the QuickTabs Instance. | |
QuickTabsInstance::getConfigurationData | public | function | Returns the array of data that will be used to build the tabs. | Overrides QuickTabsInstanceInterface::getConfigurationData |
QuickTabsInstance::getDefaultTab | public | function | Returns the number of the default tab for this instance. | Overrides QuickTabsInstanceInterface::getDefaultTab |
QuickTabsInstance::getHideEmptyTabs | public | function | Returns boolean value of empty tabs setting. | Overrides QuickTabsInstanceInterface::getHideEmptyTabs |
QuickTabsInstance::getLabel | public | function | Returns the label for the current instance. | Overrides QuickTabsInstanceInterface::getLabel |
QuickTabsInstance::getOptions | public | function | Returns the array of options that current instance will use to build a tab. | Overrides QuickTabsInstanceInterface::getOptions |
QuickTabsInstance::getQuickTabsInstance | public static | function | Loads a quicktabs_instance from configuration and returns it. | |
QuickTabsInstance::getRenderArray | public | function | Returns a render array to be used in a block or page. | |
QuickTabsInstance::getRenderer | public | function | Returns the machine name of the plugin that will render this instance. | Overrides QuickTabsInstanceInterface::getRenderer |
QuickTabsInstance::QUICKTABS_DELTA_NONE | constant | |||
QuickTabsInstance::setConfigurationData | public | function | Sets the configuration data array. | Overrides QuickTabsInstanceInterface::setConfigurationData |