function _paragraph_blocks_process_widget_form in Paragraph blocks 8.2
Same name and namespace in other branches
- 3.x paragraph_blocks.module \_paragraph_blocks_process_widget_form()
Common helper hides the admin title if it's not enabled on the field.
Parameters
array $element: The field widget form element as constructed by \Drupal\Core\Field\WidgetBaseInterface::form().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
array $context: An associative array containing the key-value pairs.
See also
hook_field_widget_WIDGET_TYPE_form_alter()
2 calls to _paragraph_blocks_process_widget_form()
File
- ./
paragraph_blocks.module, line 163 - Contains paragraph_blocks.module.
Code
function _paragraph_blocks_process_widget_form(array &$element, FormStateInterface $form_state, array $context) {
$form_object = $form_state
->getFormObject();
if ($form_object instanceof EntityFormInterface) {
$bundle = $form_object
->getEntity()
->bundle();
/** @var \Drupal\Core\Field\FieldConfigInterface $field_config */
$field_config = $context['items']
->getFieldDefinition()
->getConfig($bundle);
if (!$field_config
->getThirdPartySetting('paragraph_blocks', 'status', TRUE)) {
$element['subform']['admin_title']['#access'] = FALSE;
}
}
}