function lazy_field_formatter_third_party_settings_form in Lazy-load 8
Same name and namespace in other branches
- 8.3 lazy.module \lazy_field_formatter_third_party_settings_form()
- 8.2 lazy.module \lazy_field_formatter_third_party_settings_form()
Implements hook_field_formatter_third_party_settings_form().
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition:
$view_mode:
$form:
Return value
array
File
- ./
lazy.module, line 148 - Module file for Lazy-load.
Code
function lazy_field_formatter_third_party_settings_form($plugin, $field_definition, $view_mode, $form, $form_state) {
$element = [];
if ($plugin
->getPluginId() === 'image') {
$element['lazy_image'] = [
'#type' => 'checkbox',
'#title' => t('Enable lazy-loading'),
'#default_value' => $plugin
->getThirdPartySetting('lazy', 'lazy_image', FALSE),
];
}
return $element;
}