Skip to content

Commit d58dca8

Browse files
authored
Merge pull request #7 from dotCMS/small-fixes
updating image paths with host var, plus other changes
2 parents 4abd899 + a2172fb commit d58dca8

9 files changed

Lines changed: 13 additions & 10 deletions

File tree

examples/dotcms-laravel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ This adds the official DotCMS PHP SDK to your project, providing the necessary m
7575

7676
```
7777
DOTCMS_HOST=https://demo.dotcms.com
78-
DOTCMS_API_TOKEN=your-api-key-here
78+
DOTCMS_API_KEY=your-api-key-here
7979
```
8080

8181
These environment variables define the connection to your DotCMS instance, allowing the SDK to authenticate and make API calls.
@@ -107,7 +107,7 @@ class DotCMSServiceProvider extends ServiceProvider
107107
$this->app->singleton(DotCMSClient::class, function ($app) {
108108
$config = new Config(
109109
host: env('DOTCMS_HOST', 'https://demo.dotcms.com'),
110-
apiKey: env('DOTCMS_API_TOKEN', '')
110+
apiKey: env('DOTCMS_API_KEY', '')
111111
);
112112

113113
return new DotCMSClient($config);

examples/dotcms-laravel/app/Providers/DotCMSServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function register(): void
1616
$this->app->singleton(DotCMSClient::class, function ($app) {
1717
$config = new Config(
1818
host: env('DOTCMS_HOST', 'https://demo.dotcms.com'),
19-
apiKey: env('DOTCMS_API_TOKEN', '')
19+
apiKey: env('DOTCMS_API_KEY', '')
2020
);
2121

2222
return new DotCMSClient($config);

examples/dotcms-laravel/resources/views/dotcms/content-types/activity.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@php
22
$imagePath = null;
33
if (isset($content['image'])) {
4-
$imagePath = 'https://demo.dotcms.com/dA/' . $content['identifier'] . '/image';
4+
$imagePath = env('DOTCMS_HOST') . '/dA/' . $content['identifier'] . '/image';
55
}
66
$title = $content['title'] ?? '';
77
$description = $content['description'] ?? '';

examples/dotcms-laravel/resources/views/dotcms/content-types/banner.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@php
22
$imagePath = null;
33
if (isset($content['image'])) {
4-
$imagePath = 'https://demo.dotcms.com/dA/' . $content['identifier'] . '/image';
4+
$imagePath = env('DOTCMS_HOST') . '/dA/' . $content['identifier'] . '/image';
55
}
66
$title = $content['title'] ?? '';
77
$caption = $content['caption'] ?? '';

examples/dotcms-laravel/resources/views/dotcms/content-types/product.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@php
22
$imagePath = null;
33
if (isset($content['image'])) {
4-
$imagePath = 'https://demo.dotcms.com/dA/' . $content['identifier'] . '/image';
4+
$imagePath = env('DOTCMS_HOST') . '/dA/' . $content['identifier'] . '/image';
55
}
66
$title = $content['title'] ?? '';
77
$retailPrice = $content['retailPrice'] ?? null;

examples/dotcms-symfony/src/Twig/DotCMSExtension.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ public function generateHtmlBasedOnProperty(Contentlet $content): string
5050
if ($contentType) {
5151
$template = 'dotcms/content-types/' . strtolower($contentType) . '.twig';
5252
if ($this->twig->getLoader()->exists($template)) {
53-
return $this->twig->render($template, ['content' => $content]);
53+
return $this->twig->render($template, [
54+
'content' => $content,
55+
'dotcms_host' => $_ENV['DOTCMS_HOST'] ?? 'https://demo.dotcms.com'
56+
]);
5457
}
5558
}
5659

examples/dotcms-symfony/templates/dotcms/content-types/activity.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if content.image %}
22
{% set imageHtml %}
3-
<img src="https://demo.dotcms.com/dA/{{ content.identifier }}/image"
3+
<img src="{{ dotcms_host }}/dA/{{ content.identifier }}/image"
44
alt="{{ content.title|default('')|e('html_attr') }}">
55
{% endset %}
66
{% endif %}

examples/dotcms-symfony/templates/dotcms/content-types/banner.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if content.image %}
22
{% set imageHtml %}
3-
<img src="https://demo.dotcms.com/dA/{{ content.identifier }}/image"
3+
<img src="{{ dotcms_host }}/dA/{{ content.identifier }}/image"
44
alt="{{ content.title|default('')|e('html_attr') }}">
55
{% endset %}
66
{% endif %}

examples/dotcms-symfony/templates/dotcms/content-types/product.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% if content.image %}
22
{% set imageHtml %}
3-
<img src="https://demo.dotcms.com/dA/{{ content.identifier }}/image"
3+
<img src="{{ dotcms_host }}/dA/{{ content.identifier }}/image"
44
alt="{{ content.title|default('')|e('html_attr') }}">
55
{% endset %}
66
{% endif %}

0 commit comments

Comments
 (0)