Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InlineEditUpdater.php
Go to the documentation of this file.
1 <?php
7 
9 
11 {
15  protected $validationRules;
16 
22  protected $editableFields = [
23  'text',
24  'boolean',
25  'select',
26  'date',
27  ];
28 
32  public function __construct(
34  ) {
35  $this->validationRules = $validationRules;
36  }
37 
47  public function applyEditing(
48  UiComponentInterface $column,
49  $frontendInput,
50  array $validationRules,
51  $isRequired = false
52  ) {
53  if (in_array($frontendInput, $this->editableFields)) {
54  $config = $column->getConfiguration();
55  if (!(isset($config['editor']) && isset($config['editor']['editorType']))) {
56  if (isset($config['editor']) && is_string($config['editor'])) {
57  $editorType = $config['editor'];
58  } elseif (isset($config['dataType'])) {
59  $editorType = $config['dataType'];
60  } else {
61  $editorType = $frontendInput;
62  }
63 
64  $config['editor'] = [
65  'editorType' => $editorType
66  ];
67  }
68 
69  $validationRules = $this->validationRules->getValidationRules($isRequired, $validationRules);
70  if (!empty($config['editor']['validation'])) {
71  $validationRules = array_merge($config['editor']['validation'], $validationRules);
72  }
73  $config['editor']['validation'] = $validationRules;
74  $column->setData('config', $config);
75  }
76  return $column;
77  }
78 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$config
Definition: fraud_order.php:17
applyEditing(UiComponentInterface $column, $frontendInput, array $validationRules, $isRequired=false)