Issue #2671446 by heykarthikwithu, mikeker: The Boolean field formatter does not provide a settings summary
parent
2c88729acf
commit
89eadd7286
|
@ -114,6 +114,30 @@ class BooleanFormatter extends FormatterBase {
|
||||||
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 @@ class BooleanFormatterSettingsTest extends WebTestBase {
|
||||||
}
|
}
|
||||||
$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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue