diff --git a/css/cloudimage.css b/css/cloudimage.css
index 341761e..159e157 100644
--- a/css/cloudimage.css
+++ b/css/cloudimage.css
@@ -1,6 +1,6 @@
img[ci-src] {
- opacity: 0;
+ opacity: 0;
}
img.ci-image-loaded {
- opacity: 1;
-}
\ No newline at end of file
+ opacity: 1;
+}
diff --git a/js/cloudimage.js b/js/cloudimage.js
index ab09925..34c5423 100644
--- a/js/cloudimage.js
+++ b/js/cloudimage.js
@@ -6,7 +6,7 @@
(function ($, Drupal, drupalSettings) {
'use strict';
-
+
/**
* Behavior description.
*/
@@ -15,5 +15,5 @@
ciResponsive.process();
}
};
-
- } (jQuery, Drupal));
\ No newline at end of file
+
+ } (jQuery, Drupal));
diff --git a/scaleflex_cloudimage.info.yml b/scaleflex_cloudimage.info.yml
index 2ecde76..35bf193 100644
--- a/scaleflex_cloudimage.info.yml
+++ b/scaleflex_cloudimage.info.yml
@@ -2,4 +2,4 @@ name: Scaleflex Cloudimage
description: Scaleflex/cloudimage.
core_version_requirement: ^9 || ^10
type: module
-package: cloudimage
\ No newline at end of file
+package: cloudimage
diff --git a/scaleflex_cloudimage.libraries.yml b/scaleflex_cloudimage.libraries.yml
index 2fb6002..005876f 100644
--- a/scaleflex_cloudimage.libraries.yml
+++ b/scaleflex_cloudimage.libraries.yml
@@ -7,4 +7,4 @@ cloudimage:
js/cloudimage.js: {}
dependencies:
- core/drupal
- - core/drupalSettings
\ No newline at end of file
+ - core/drupalSettings
diff --git a/scaleflex_cloudimage.links.menu.yml b/scaleflex_cloudimage.links.menu.yml
index 6aaf3d0..8813851 100644
--- a/scaleflex_cloudimage.links.menu.yml
+++ b/scaleflex_cloudimage.links.menu.yml
@@ -3,4 +3,4 @@ scaleflex_cloudimage.root_config:
description: 'config cloudimage'
parent: system.admin_config
route_name: scaleflex_cloudimage.config
- weight: 100
\ No newline at end of file
+ weight: 100
diff --git a/scaleflex_cloudimage.module b/scaleflex_cloudimage.module
index 3022c90..b793b22 100644
--- a/scaleflex_cloudimage.module
+++ b/scaleflex_cloudimage.module
@@ -1,5 +1,9 @@
get('token') ."',
+ token: '" . $config->get('token') . "',
apiVersion: null
});";
$variables['page_bottom'][] = [
@@ -43,4 +50,4 @@ function scaleflex_cloudimage_preprocess_html(array &$variables){
*/
function scaleflex_cloudimage_cron() {
\Drupal::service('cloudimage.cdnscaleflex')->exportImageUrls();
-}
\ No newline at end of file
+}
diff --git a/scaleflex_cloudimage.services.yml b/scaleflex_cloudimage.services.yml
index 2132fa1..47c2a7c 100644
--- a/scaleflex_cloudimage.services.yml
+++ b/scaleflex_cloudimage.services.yml
@@ -1,4 +1,4 @@
services:
cloudimage.cdnscaleflex:
class: Drupal\scaleflex_cloudimage\CloudimageService
- arguments: ['@config.factory', '@logger.factory', '@file_system']
\ No newline at end of file
+ arguments: ['@config.factory', '@logger.factory', '@file_system']
diff --git a/src/CloudimageService.php b/src/CloudimageService.php
index f76ab1d..05270ed 100644
--- a/src/CloudimageService.php
+++ b/src/CloudimageService.php
@@ -2,13 +2,15 @@
namespace Drupal\scaleflex_cloudimage;
-use Drupal;
use Symfony\Component\HttpFoundation\Response;
use GuzzleHttp\Client;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
+/**
+ * Cloud Image Service.
+ */
class CloudimageService {
/**
@@ -25,26 +27,30 @@ class CloudimageService {
*/
protected $fileSystem;
+ /**
+ * {@inheritdoc}
+ */
public function __construct(ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger, FileSystemInterface $file_system) {
$this->getCloudimgSettings = $config_factory->get('cloudimage.settings');
$this->logger = $logger->get('cloudimage');
$this->fileSystem = $file_system;
}
+ /**
+ * {@inheritdoc}
+ */
public function exportImageUrls() {
$config = $this->getCloudimgSettings;
$url_base = \Drupal::service('router.request_context')->getCompleteBaseUrl();
$dir = 'public://';
- if(!empty($this->fileSystem->scanDirectory($dir, '/\.(gif|jpg|jpeg|png|svg)$/i')))
- {
+ if (!empty($this->fileSystem->scanDirectory($dir, '/\.(gif|jpg|jpeg|png|svg)$/i'))) {
$files = $this->fileSystem->scanDirectory($dir, '/\.(gif|jpg|jpeg|png|svg)$/i');
$images = [];
foreach ($files as $file) {
- if(!empty($config->get('url_site')))
- {
- $image_path = str_replace($url_base, $config->get('url_site') , file_create_url($file->uri));
+ if (!empty($config->get('url_site'))) {
+ $image_path = str_replace($url_base, $config->get('url_site'), file_create_url($file->uri));
}
- else{
+ else {
$image_path = file_create_url($file->uri);
}
$images[] = $image_path;
@@ -60,10 +66,10 @@ class CloudimageService {
'data' => $images,
],
]);
- $message = "{ \n" . "status".":"."success".",\n"."count_added".":". count($images) ."\n }";
+ $message = "{ \n" . "status" . ":" . "success" . ",\n" . "count_added" . ":" . count($images) . "\n }";
$this->logger->notice($message);
return $response;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/CloudimageForm.php b/src/Form/CloudimageForm.php
index 711b756..f3499e7 100644
--- a/src/Form/CloudimageForm.php
+++ b/src/Form/CloudimageForm.php
@@ -1,6 +1,5 @@
cloudimageConfig = $this->config('cloudimage.settings');
@@ -32,7 +37,7 @@ class CloudimageForm extends ConfigFormBase {
* {@inheritdoc}
*/
public function getEditableConfigNames() {
- return [ 'cloudimage.settings' ];
+ return ['cloudimage.settings'];
}
/**
@@ -41,25 +46,25 @@ class CloudimageForm extends ConfigFormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('cloudimage.settings');
$form['#title'] = $this->t('Cloud Image Settings');
- $form['client_key']= [
- '#type' => 'textfield',
- '#title' => 'Please enter the client key',
- '#default_value' => $config->get('client_key'),
- '#description' => t("X-Client-Key is the client's API key (can be found in Admin Console left menu : Settings / CDN Invalidation)."),
- ];
+ $form['client_key'] = [
+ '#type' => 'textfield',
+ '#title' => 'Please enter the client key',
+ '#default_value' => $config->get('client_key'),
+ '#description' => $this->t("X-Client-Key is the client's API key (can be found in Admin Console left menu : Settings / CDN Invalidation)."),
+ ];
- $form['token']= [
- '#type' => 'textfield',
- '#title' => 'Please enter the token',
- '#default_value' => $config->get('token'),
- '#description' => t("Your token"),
- ];
- $form['url_site']= [
- '#type' => 'textfield',
- '#title' => 'Please enter the website URL',
- '#default_value' => $config->get('url_site'),
- '#description' => t("Your website URL https://www.example.com"),
- ];
+ $form['token'] = [
+ '#type' => 'textfield',
+ '#title' => 'Please enter the token',
+ '#default_value' => $config->get('token'),
+ '#description' => $this->t("Your token"),
+ ];
+ $form['url_site'] = [
+ '#type' => 'textfield',
+ '#title' => 'Please enter the website URL',
+ '#default_value' => $config->get('url_site'),
+ '#description' => $this->t("Your website URL https://www.example.com"),
+ ];
return parent::buildForm($form, $form_state);
}
@@ -73,4 +78,5 @@ class CloudimageForm extends ConfigFormBase {
$this->cloudimageConfig->save();
parent::submitForm($form, $form_state);
}
+
}