function _label_length_limit_set_translation_label_length in Override label length limititation 8
Same name and namespace in other branches
- 2.0.x label_length_limit.module \_label_length_limit_set_translation_label_length()
Change max length limit on label fields.
Parameters
mixed $form: Nested array of form elements that comprise the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. The arguments that \Drupal::formBuilder()->getForm() was originally called with are available in the array $form_state->getBuildInfo()['args'].
string $form_id: String representing the name of the form itself. Typically this is the name of the function that generated the form.
2 calls to _label_length_limit_set_translation_label_length()
File
- ./
label_length_limit.module, line 107 - Contains label_length_limit.module.
Code
function _label_length_limit_set_translation_label_length(&$form, FormStateInterface $form_state, $form_id) {
$config = \Drupal::config('label_length_limit.labellengthlimit');
$label_max_length = $config
->get('label_max_length');
foreach ($form['config_names'] as $config_name => $config_value) {
if (isset($form['config_names'][$config_name]['label']['translation']) && $form['config_names'][$config_name]['label']['translation']['#type'] === 'textfield') {
$form['config_names'][$config_name]['label']['translation']['#maxlength'] = $label_max_length;
}
}
}