Commit c9b25308 authored by webchick's avatar webchick

Issue #2452957 by claudiu.cristea: Remove node & taxonomy term hardcoding of...

Issue #2452957 by claudiu.cristea: Remove node & taxonomy term hardcoding of bundle names in SelectionBase
parent 069777ac
......@@ -124,18 +124,9 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$bundle_options[$bundle_name] = $bundle_info['label'];
}
$target_bundles_title = $this->t('Bundles');
// Default core entity types with sensible labels.
if ($entity_type_id == 'node') {
$target_bundles_title = $this->t('Content types');
}
elseif ($entity_type_id == 'taxonomy_term') {
$target_bundles_title = $this->t('Vocabularies');
}
$form['target_bundles'] = array(
'#type' => 'checkboxes',
'#title' => $target_bundles_title,
'#title' => $this->t('Bundles'),
'#options' => $bundle_options,
'#default_value' => (!empty($selection_handler_settings['target_bundles'])) ? $selection_handler_settings['target_bundles'] : array(),
'#required' => TRUE,
......
......@@ -8,6 +8,7 @@
namespace Drupal\node\Plugin\EntityReferenceSelection;
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides specific access control for the node entity type.
......@@ -22,6 +23,15 @@
*/
class NodeSelection extends SelectionBase {
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['target_bundles']['#title'] = $this->t('Content types');
return $form;
}
/**
* {@inheritdoc}
*/
......
......@@ -39,6 +39,7 @@ public function entityQueryAlter(SelectInterface $query) {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['target_bundles']['#title'] = $this->t('Vocabularies');
// @todo: Currently allow auto-create only on taxonomy terms.
$form['auto_create'] = array(
'#type' => 'checkbox',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment