本文整理汇总了PHP中Drupal\Core\Field\WidgetBase::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP WidgetBase::__construct方法的具体用法?PHP WidgetBase::__construct怎么用?PHP WidgetBase::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Field\WidgetBase
的用法示例。
在下文中一共展示了WidgetBase::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs a new instance.
*
* @param string $plugin_id
* The plugin_id for the widget.
* @param mixed[] $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param mied[] $settings
* The widget settings.
* @param array[] $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
* @param \Drupal\payment_reference\PaymentFactoryInterface $payment_factory
* The payment reference factory.
*/
public function __construct($plugin_id, array $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ConfigFactoryInterface $config_factory, AccountInterface $current_user, PaymentFactoryInterface $payment_factory)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->configFactory = $config_factory;
$this->currentUser = $current_user;
$this->paymentFactory = $payment_factory;
}
示例2: __construct
/**
* Constructs an InlineEntityFormBase object.
*
* @param array $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->entityTypeManager = $entity_type_manager;
$this->initializeIefController();
}
示例3: __construct
/**
* Constructs widget plugin.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* Event dispatcher service.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* Entity manager service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* Event dispatcher.
* @param \Drupal\entity_browser\FieldWidgetDisplayManager $field_display_manager
* Field widget display plugin manager.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityManagerInterface $entity_manager, EventDispatcherInterface $event_dispatcher, FieldWidgetDisplayManager $field_display_manager)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityManager = $entity_manager;
$this->fieldDisplayManager = $field_display_manager;
$event_dispatcher->addListener(Events::REGISTER_JS_CALLBACKS, [$this, 'registerJSCallback']);
}
示例4: __construct
/**
* Constructs an InlineEntityFormBase object.
*
* @param array $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface
* The entity display repository.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->entityTypeManager = $entity_type_manager;
$this->entityDisplayRepository = $entity_display_repository;
$this->createInlineFormHandler();
}
示例5: __construct
/**
* Constructs a new PriceDefaultWidget object.
*
* @param string $pluginId
* The plugin_id for the widget.
* @param mixed $pluginDefinition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $thirdPartySettings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Drupal\commerce_price\NumberFormatterFactoryInterface $numberFormatterFactory
* The number formatter factory.
*/
public function __construct($pluginId, $pluginDefinition, FieldDefinitionInterface $fieldDefinition, array $settings, array $thirdPartySettings, EntityTypeManagerInterface $entityTypeManager, NumberFormatterFactoryInterface $numberFormatterFactory) {
parent::__construct($pluginId, $pluginDefinition, $fieldDefinition, $settings, $thirdPartySettings);
$this->currencyStorage = $entityTypeManager->getStorage('commerce_currency');
$this->numberFormatter = $numberFormatterFactory->createInstance(NumberFormatterInterface::DECIMAL);
$this->numberFormatter->setMinimumFractionDigits(0);
$this->numberFormatter->setMaximumFractionDigits(6);
$this->numberFormatter->setGroupingUsed(FALSE);
}
示例6: __construct
/**
* Constructs widget plugin.
*
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* Entity manager service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* Event dispatcher.
* @param \Drupal\entity_browser\FieldWidgetDisplayManager $field_display_manager
* Field widget display plugin manager.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityManagerInterface $entity_manager, EventDispatcherInterface $event_dispatcher, FieldWidgetDisplayManager $field_display_manager)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityManager = $entity_manager;
$this->fieldDisplayManager = $field_display_manager;
}
示例7: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ConfigFactoryInterface $config_factory)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->configFactory = $config_factory;
}
示例8: __construct
/**
* Constructs a AddressDefaultWidget object.
*
* @param string $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \CommerceGuys\Addressing\Repository\AddressFormatRepositoryInterface $address_format_repository
* The address format repository.
* @param \CommerceGuys\Addressing\Repository\CountryRepositoryInterface $country_repository
* The country repository.
* @param \CommerceGuys\Addressing\Repository\SubdivisionRepositoryInterface $subdivision_repository
* The subdivision repository.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, AddressFormatRepositoryInterface $address_format_repository, CountryRepositoryInterface $country_repository, SubdivisionRepositoryInterface $subdivision_repository, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->addressFormatRepository = $address_format_repository;
$this->countryRepository = $country_repository;
$this->subdivisionRepository = $subdivision_repository;
$this->eventDispatcher = $event_dispatcher;
$this->configFactory = $config_factory;
}
示例9: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, MetatagManager $manager)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->metatagManager = $manager;
}
示例10: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityStorageInterface $term_storage, VocabularyStorageInterface $vocabulary_storage)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->termStorage = $term_storage;
$this->vocabularyStorage = $vocabulary_storage;
}
示例11: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->metatagManager = \Drupal::service('metatag.manager');
}
示例12: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityStorageInterface $date_storage)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->dateStorage = $date_storage;
}
示例13: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, AccountInterface $current_user)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, array());
$this->currentUser = $current_user;
}
示例14: __construct
/**
* Constructs a new ProductVariationAttributesWidget object.
*
* @param string $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, EntityTypeManagerInterface $entity_type_manager)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->variationStorage = $entity_type_manager->getStorage('commerce_product_variation');
}
示例15: __construct
/**
* {@inheritdoc}
*/
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings)
{
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$property_names = $this->fieldDefinition->getFieldStorageDefinition()->getPropertyNames();
$this->column = $property_names[0];
}