Commit 71aac1fb authored by marcvangend's avatar marcvangend

more consistent variable names

parent 9ce62adc
......@@ -55,19 +55,19 @@ function fieldblock_field_display_submit($form, FormStateInterface $form_state)
$bundle = $form['#bundle'];
$mode = $form['#mode'];
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_mode_config */
$view_mode_config = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity_view_display */
$entity_view_display = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $mode);
$fields = $form_state->getValue('fields');
foreach ($fields as $field_name => $field) {
if (isset($field['fieldblock']) && $field['fieldblock'] == 1) {
$view_mode_config->setThirdPartySetting('fieldblock', $field_name, $form['fields'][$field_name]['human_name']['#markup']);
$entity_view_display->setThirdPartySetting('fieldblock', $field_name, $form['fields'][$field_name]['human_name']['#markup']);
}
else if ($view_mode_config->getThirdPartySetting('fieldblock', $field_name)) {
$view_mode_config->unsetThirdPartySetting('fieldblock', $field_name);
else if ($entity_view_display->getThirdPartySetting('fieldblock', $field_name)) {
$entity_view_display->unsetThirdPartySetting('fieldblock', $field_name);
}
}
$view_mode_config->save();
$entity_view_display->save();
// Invalidate the block cache to update fielblock derivatives.
if (\Drupal::moduleHandler()->moduleExists('block')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment