Commit 22041caf authored by Arnaud Bour's avatar Arnaud Bour

Minor bug fixes

parent 4fdc95d1
......@@ -158,4 +158,4 @@ function ephoto_dam_button_enabled(FormStateInterface $form_state) {
}
return $button_enabled;
}
\ No newline at end of file
}
......@@ -8,7 +8,7 @@
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Serialization\Json;
use \Drupal\Core\Render\Markup;
use Drupal\Core\Render\Markup;
use Drupal\Core\Url;
/**
......@@ -17,15 +17,14 @@ use Drupal\Core\Url;
function ephoto_dam_field_field_widget_form_alter(&$element, &$form_state, $context) {
$field_definition = $context['items']->getFieldDefinition();
$common_settings = \Drupal::config('ephoto_dam.settings');
$settings = $field_definition->getSettings();
$settings['server_url'] = $common_settings->get('server_url');
if ($field_definition->getType() === 'ephoto_dam_field') {
$element['#attached']['library'][] = 'ephoto_dam_field/edit';
$common_settings = \Drupal::config('ephoto_dam.settings');
$settings = $field_definition->getSettings();
$settings['server_url'] = $common_settings->get('server_url');
$element['#attached']['library'][] = 'ephoto_dam_field/edit';
$element['#attached']['drupalSettings']['ephotoDamField'] = $settings;
}
}
......
......@@ -27,7 +27,7 @@ class EphotoDam extends CKEditorPluginBase implements CKEditorPluginConfigurable
* @const
*/
private const DEFAULT_SETTINGS = [
'server_url' => '/',
'server_url' => '',
'captions' => true,
'captions_format' => '',
'zoom' => true,
......@@ -143,11 +143,15 @@ class EphotoDam extends CKEditorPluginBase implements CKEditorPluginConfigurable
'ephoto_dam',
]);
if(!$settings) {
if (!$settings) {
$settings = self::DEFAULT_SETTINGS;
}
$settings['server_url'] = $common_settings->get('server_url');
$server_url = $common_settings->get('server_url');
if ($server_url) {
$settings['server_url'] = $server_url;
}
return $settings;
}
......
......@@ -184,12 +184,6 @@ class EphotoDam extends FilterBase implements ContainerFactoryPluginInterface {
}
}
$common_settings = \Drupal::config('ephoto_dam.settings');
if ($common_settings->get('server_url')) {
return false;
}
return true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment