Skip to content
Snippets Groups Projects
Commit a4217e4d authored by Kurucz István's avatar Kurucz István
Browse files

Issue #3496272 by nevergone: Refactor deprecated code

parent 90dc0ccc
Branches
Tags
No related merge requests found
<?php
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
/**
* Implements hook_field_widget_third_party_settings_form().
*/
function field_lock_multi_values_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, string $form_mode, array $form, \Drupal\Core\Form\FormStateInterface $form_state) : array {
function field_lock_multi_values_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, string $form_mode, array $form, FormStateInterface $form_state) : array {
$element = [];
$field_storage = $field_definition->getFieldStorageDefinition();
$plugin_definition = $plugin->getPluginDefinition();
......@@ -68,17 +69,17 @@ function field_lock_multi_values_field_widget_settings_summary_alter(array &$sum
}
/**
* Implements hook_field_widget_multivalue_form_alter().
* Implements hook_field_widget_complete_form_alter().
*/
function field_lock_multi_values_field_widget_multivalue_form_alter(array &$elements, \Drupal\Core\Form\FormStateInterface $form_state, array $context) : void {
function field_lock_multi_values_field_widget_complete_form_alter(array &$field_widget_complete_form, FormStateInterface $form_state, array $context) : void {
$settings = $context['widget']->getThirdPartySetting('field_lock_multi_values', 'settings');
$elements['#field_lock_multi_values'] = $settings;
$field_widget_complete_form['widget']['#field_lock_multi_values'] = $settings;
}
/**
* Implements hook_field_widget_form_alter().
* Implements hook_field_widget_single_element_form_alter().
*/
function field_lock_multi_values_field_widget_form_alter(array &$element, \Drupal\Core\Form\FormStateInterface $form_state, array $context) : void {
function field_lock_multi_values_field_widget_single_element_form_alter(array &$element, FormStateInterface $form_state, array $context) : void {
$settings = $context['widget']->getThirdPartySetting('field_lock_multi_values', 'settings');
if ($settings !== NULL) {
$element_children = Element::children($element);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment