You are here

public function TwitterButtonWidget::setDependentConfiguration in Twitter Embed 8

Set the configuration state based on the chosen options.

Some options are dependent to others, resets the options that does not need values or set the default configuration to avoid a configuration state that does not comply with the Twitter widgets.

Parameters

array $configuration: List of selected configuration.

Overrides TwitterWidgetInterface::setDependentConfiguration

File

src/TwitterButtonWidget.php, line 141

Class

TwitterButtonWidget
Class TwitterButtonWidget.

Namespace

Drupal\twitter_embed

Code

public function setDependentConfiguration(array &$configuration) {

  // @todo these rules should be used in form validation.
  // Uncheck the hide_username and hide_followers_count when unnecessary.
  if (!in_array($configuration['display_style'], [
    'follow-button',
  ])) {
    $configuration['hide_username'] = FALSE;
    $configuration['hide_followers_count'] = FALSE;
  }
}