ProductAttributeTranslationAddForm.php in Commerce Core 8.2
File
modules/product/src/Form/ProductAttributeTranslationAddForm.php
View source
<?php
namespace Drupal\commerce_product\Form;
use Drupal\commerce\InlineFormManager;
use Drupal\config_translation\ConfigMapperManagerInterface;
use Drupal\config_translation\Form\ConfigTranslationAddForm;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\language\ConfigurableLanguageManagerInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class ProductAttributeTranslationAddForm extends ConfigTranslationAddForm {
use ProductAttributeTranslationFormTrait;
public function __construct(TypedConfigManagerInterface $typed_config_manager, ConfigMapperManagerInterface $config_mapper_manager, ConfigurableLanguageManagerInterface $language_manager, EntityTypeManagerInterface $entity_type_manager, InlineFormManager $inline_form_manager) {
parent::__construct($typed_config_manager, $config_mapper_manager, $language_manager);
$this->entityTypeManager = $entity_type_manager;
$this->inlineFormManager = $inline_form_manager;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('config.typed'), $container
->get('plugin.manager.config_translation.mapper'), $container
->get('language_manager'), $container
->get('entity_type.manager'), $container
->get('plugin.manager.commerce_inline_form'));
}
public function buildForm(array $form, FormStateInterface $form_state, RouteMatchInterface $route_match = NULL, $plugin_id = NULL, $langcode = NULL) {
$form = parent::buildForm($form, $form_state, $route_match, $plugin_id, $langcode);
$form = $this
->buildValuesForm($form, $form_state, $this->mapper
->getEntity());
return $form;
}
protected function getEntityTypeManager() {
return $this->entityTypeManager;
}
}