Skip to content
Snippets Groups Projects
Commit 89eadd72 authored by catch's avatar catch
Browse files

Issue #2671446 by heykarthikwithu, mikeker: The Boolean field formatter does...

Issue #2671446 by heykarthikwithu, mikeker: The Boolean field formatter does not provide a settings summary
parent 2c88729a
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,30 @@ public function settingsForm(array $form, FormStateInterface $form_state) { ...@@ -114,6 +114,30 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
return $form; return $form;
} }
/**
* {@inheritdoc}
*/
public function settingsSummary() {
$summary = [];
$setting = $this->getSetting('format');
if ($setting == 'custom') {
$summary[] = $this->t('Custom text: @true_label / @false_label', [
'@true_label' => $this->getSetting('format_custom_true'),
'@false_label' => $this->getSetting('format_custom_false'),
]);
}
else {
$formats = $this->getOutputFormats();
$summary[] = $this->t('Display: @true_label / @false_label', [
'@true_label' => $formats[$setting][0],
'@false_label' => $formats[$setting][1],
]);
}
return $summary;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -125,6 +125,12 @@ function testBooleanFormatterSettings() { ...@@ -125,6 +125,12 @@ function testBooleanFormatterSettings() {
} }
$this->assertText(SafeMarkup::format($default, array('@on' => $values[0], '@off' => $values[1]))); $this->assertText(SafeMarkup::format($default, array('@on' => $values[0], '@off' => $values[1])));
} }
foreach ($settings as $values) {
$this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/display');
$result = $this->xpath('//div[contains(@class, :class) and contains(text(), :text)]', [':class' => 'field-plugin-summary', ':text' => 'Display: TRUE / FALSE']);
$this->assertEqual(count($result), 1, "Boolean formatter settings summary exist.");
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment