Skip to content
Snippets Groups Projects

Always return an array

Merged Adam G-H requested to merge issue/date_augmenter-3527500:3527500-it-is-possible into 1.1.x
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
+ 3
3
@@ -13,17 +13,17 @@ use Drupal\Core\Plugin\PluginFormInterface;
*
* Adds extra configuration fields to compatible date fields.
*/
function date_augmenter_field_formatter_third_party_settings_form($plugin, $field_definition, $form_mode, $form, $form_state) {
function date_augmenter_field_formatter_third_party_settings_form($plugin, $field_definition, $form_mode, $form, $form_state): array {
// Check if the formatter has explicitly delcared support.
if (!method_exists($plugin, 'supportsDateAugmenter') || !$sets = $plugin->supportsDateAugmenter()) {
return;
return [];
}
// Make sure the service is available.
$dateAugmenterManager = \Drupal::service('plugin.manager.dateaugmenter');
if (!$dateAugmenterManager) {
// @todo throw an error here?
return;
return [];
}
$augmenters = $dateAugmenterManager->getDefinitions();
Loading