whitelabel-8.x-2.x-dev/src/Plugin/EntityReferenceSelection/WhiteLabelSelection.php
src/Plugin/EntityReferenceSelection/WhiteLabelSelection.php
<?php
namespace Drupal\whitelabel\Plugin\EntityReferenceSelection;
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
use Drupal\Core\Form\FormStateInterface;
/**
* Default plugin implementation of the Entity Reference Selection plugin.
*
* @EntityReferenceSelection(
* id = "default:whitelabel",
* label = @Translation("White label"),
* group = "default",
* entity_types = {"whitelabel"},
* weight = 10
* )
*/
class WhiteLabelSelection extends DefaultSelection {
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
// For the 'target_bundles' setting, a NULL value is equivalent to "allow
// entities from any bundle to be referenced" and an empty array value is
// equivalent to "no entities from any bundle can be referenced".
'auto_create' => TRUE,
] + parent::defaultConfiguration();
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
// Do not show any form. There is nothing to configure.
return [];
}
}
