public function PrintLinks::blockForm in Entity Print 8.2
Overrides BlockPluginTrait::blockForm
File
- src/
Plugin/ Block/ PrintLinks.php, line 83
Class
- PrintLinks
- Provides a block with a link to print entities.
Namespace
Drupal\entity_print\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$config = $this->configuration;
$form['print'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this
->t('Print Links'),
'#tree' => TRUE,
];
foreach ($this->exportTypeManager
->getDefinitions() as $plugin_id => $definition) {
$form['print'][$plugin_id . '_enabled'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable %export_type Link', [
'%export_type' => $definition['label'],
]),
'#default_value' => $config[$plugin_id . '_enabled'],
];
$form['print'][$plugin_id . '_link_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Link text'),
'#default_value' => $config[$plugin_id . '_link_text'],
'#states' => [
'visible' => [
':input[name="settings[print][' . $plugin_id . '_enabled]"]' => [
'checked' => TRUE,
],
],
],
];
}
return $form;
}