Issue #2452957 by claudiu.cristea: Remove node & taxonomy term hardcoding of bundle names in SelectionBase
parent
069777ac1b
commit
c9b25308c8
|
@ -124,18 +124,9 @@ class SelectionBase extends PluginBase implements SelectionInterface, ContainerF
|
|||
$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 @@ use Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionBase;
|
|||
*/
|
||||
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 @@ class TermSelection extends SelectionBase {
|
|||
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',
|
||||
|
|
Loading…
Reference in New Issue