function update_entity_field_element_click in Modal 5.0.x
Same name and namespace in other branches
- 8.3 modal_page.install \update_entity_field_element_click()
- 8.2 modal_page.install \update_entity_field_element_click()
- 4.0.x modal_page.install \update_entity_field_element_click()
- 4.1.x modal_page.install \update_entity_field_element_click()
Create field to open modal by element click.
1 call to update_entity_field_element_click()
- modal_page_update_8204 in ./
modal_page.install - Add new field on entity to open modal by element click.
File
- ./
modal_page.install, line 478 - Install, update and uninstall functions for the Modal Page.
Code
function update_entity_field_element_click() {
$field_storage_definition = BaseFieldDefinition::create('string')
->setLabel(t('Open this modal clicking on this element'))
->setDescription(t('Example: <b>.open-modal-welcome</b>'))
->setRequired(FALSE)
->setSettings([
'max_length' => 255,
'text_processing' => 0,
])
->setDefaultValue(NULL)
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -5,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -5,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('open_modal_on_element_click', 'modal_page_modal', 'modal_page_modal', $field_storage_definition);
}