Skip to content
Snippets Groups Projects

Add image title field export, remove image loading setting

1 file
+ 14
26
Compare changes
  • Side-by-side
  • Inline
@@ -39,32 +39,20 @@ class ImageExportFormatter extends ImageFormatter {
@@ -39,32 +39,20 @@ class ImageExportFormatter extends ImageFormatter {
public function settingsForm(array $form, FormStateInterface $formState): array {
public function settingsForm(array $form, FormStateInterface $formState): array {
$form = parent::settingsForm($form, $formState);
$form = parent::settingsForm($form, $formState);
unset($form['image_link']);
unset($form['image_link']);
unset($form['image_loading']);
$alt = $this->getFieldSetting('alt_field');
$title = $this->getFieldSetting('title_field');
$form['export_alt'] = [
'#type' => 'checkbox',
if ($alt) {
'#title' => $this->t('Export <em>Alt</em> field'),
$form['export_alt'] = [
'#description' => $this->t('Enabling this will export an object instead of a string.'),
'#type' => 'checkbox',
'#default_value' => $this->getSetting('export_alt'),
'#title' => $this->t('Export <em>Alt</em> field'),
];
'#description' => $this->t('Enabling this will export an object instead of a string.'),
$form['export_title'] = [
'#default_value' => $this->getSetting('export_alt'),
'#type' => 'checkbox',
];
'#title' => $this->t('Export <em>Title</em> field'),
}
'#description' => $this->t('Enabling this will export an object instead of a string.'),
else {
'#default_value' => $this->getSetting('export_title'),
$form['export_alt'] = ['#type' => 'value', '#value' => FALSE];
];
}
if ($title) {
$form['export_title'] = [
'#type' => 'checkbox',
'#title' => $this->t('Export <em>Title</em> field'),
'#description' => $this->t('Enabling this will export an object instead of a string.'),
'#default_value' => $this->getSetting('export_title'),
];
}
else {
$form['export_title'] = ['#type' => 'value', '#value' => FALSE];
}
return $form;
return $form;
}
}
Loading