public function TwitterTimelineWidget::setSettingsFormStates in Twitter Embed 8
Set the settings form #states based the context selector.
The javascript selector changes, depending on the FieldFormatter or Block implementation.
Parameters
array $form: The original Form array.
string $selector: The javascript selector.
Return value
array The form array with states for form elements.
Overrides TwitterWidgetInterface::setSettingsFormStates
File
- src/
TwitterTimelineWidget.php, line 204
Class
- TwitterTimelineWidget
- Class TwitterTimelineWidget.
Namespace
Drupal\twitter_embedCode
public function setSettingsFormStates(array $form, $selector) {
$form['type_value']['#states'] = [
'visible' => [
// Implicit or.
[
'input[name="' . $selector . '[type]"]' => [
'value' => 'list',
],
],
[
'input[name="' . $selector . '[type]"]' => [
'value' => 'collection',
],
],
],
'required' => [
// Implicit or.
[
'input[name="' . $selector . '[type]"]' => [
'value' => 'list',
],
],
[
'input[name="' . $selector . '[type]"]' => [
'value' => 'collection',
],
],
],
];
$form['display_style']['#states'] = [
'visible' => [
[
'input[name="' . $selector . '[type]"]' => [
'value' => 'collection',
],
],
],
];
return $form;
}