You are here

public function CatalogBlock::blockSubmit in Ubercart 8.4

Overrides BlockPluginTrait::blockSubmit

File

uc_catalog/src/Plugin/Block/CatalogBlock.php, line 117

Class

CatalogBlock
Provides the product catalog block.

Namespace

Drupal\uc_catalog\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['link_title'] = $form_state
    ->getValue('link_title');
  $this->configuration['expanded'] = $form_state
    ->getValue('expanded');
  $this->configuration['product_count'] = $form_state
    ->getValue('product_count');

  // @todo Remove this code when catalog block theming is fully converted.
  // Theme function should use block configuration, not uc_catalog.settings.
  $catalog_config = $this->configFactory
    ->getEditable('uc_catalog.settings');
  $catalog_config
    ->set('expand_categories', $form_state
    ->getValue('expanded'))
    ->set('block_nodecount', $form_state
    ->getValue('product_count'))
    ->set('block_title_link', $form_state
    ->getValue('link_title'))
    ->save();
}