function TimestampFormatter::buildStates

Same name in other branches
  1. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter::buildStates()

Builds the #states key for form elements.

Parameters

string[] $path: The remote element path.

array $conditions: The conditions to be checked.

Return value

array[] The #states array.

1 call to TimestampFormatter::buildStates()
TimestampFormatter::settingsForm in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php
Returns a form to configure settings for the formatter.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php, line 343

Class

TimestampFormatter
Plugin implementation of the 'timestamp' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

protected function buildStates(array $path, array $conditions) : array {
    $path = '[' . implode('][', $path) . ']';
    return [
        'visible' => [
            [
                ":input[name='fields[{$this->fieldDefinition->getName()}][settings_edit_form][settings]{$path}']" => $conditions,
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.