submitVisibility example

    // settings form element, so just pass that to the block for submission.     $sub_form_state = SubformState::createForSubform($form['settings']$form$form_state);
    // Call the plugin submit handler.     $block = $entity->getPlugin();
    $this->getPluginForm($block)->submitConfigurationForm($form$sub_form_state);
    // If this block is context-aware, set the context mapping.     if ($block instanceof ContextAwarePluginInterface && $block->getContextDefinitions()) {
      $context_mapping = $sub_form_state->getValue('context_mapping', []);
      $block->setContextMapping($context_mapping);
    }

    $this->submitVisibility($form$form_state);

    // Save the settings of the plugin.     $entity->save();

    $this->messenger()->addStatus($this->t('The block configuration has been saved.'));
    $form_state->setRedirect(
      'block.admin_display_theme',
      [
        'theme' => $form_state->getValue('theme'),
      ],
      ['query' => ['block-placement' => Html::getClass($this->entity->id())]]
    );
Home | Imprint | This part of the site doesn't use cookies.