Skip to content

Commit 869053f

Browse files
authored
Merge pull request #3 from dotCMS/add-uve-editor
Add uve editor
2 parents a913be6 + e68211c commit 869053f

5 files changed

Lines changed: 36 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ echo "Layout header: " . $page->layout->header . "\n";
232232
// Access containers and contentlets
233233
foreach ($page->containers as $containerId => $container) {
234234
echo "Container ID: " . $containerId . "\n";
235+
echo "Max Contentlets: " . ($container->maxContentlets ?? 0) . "\n";
235236

236237
if (!empty($container->contentlets)) {
237238
foreach ($container->contentlets as $uuid => $contentletArray) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
import './bootstrap';
2+
3+
// dotUVE is a global variable that is set by the dotCMS UVE JavaScript API
4+
if (window.dotUVE) {
5+
window.dotUVE.createUVESubscription('changes', (changes) => {
6+
window.location.reload();
7+
})
8+
} else {
9+
console.warn('dotUVE is not available, you might experience issues with the the Universal Visual Editor');
10+
}

examples/dotcms-symfony/assets/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ import './bootstrap.js';
88
import './styles/app.css';
99

1010
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
11+
12+
// dotUVE is a global variable that is set by the dotCMS UVE JavaScript API
13+
if (window.dotUVE) {
14+
window.dotUVE.createUVESubscription('changes', (changes) => {
15+
window.location.reload();
16+
})
17+
} else {
18+
console.warn('dotUVE is not available, you might experience issues with the the Universal Visual Editor');
19+
}

examples/dotcms-symfony/templates/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
{% block javascripts %}
1212
{% block importmap %}{{ importmap('app') }}{% endblock %}
13+
<script src="{{ app.request.server.get('DOTCMS_HOST') }}/ext/uve/dot-uve.js"></script>
1314
{% endblock %}
1415
</head>
1516
<body>

examples/navigation_example.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
// Create a configuration
99
$config = new Config(
10-
'https://demo.dotcms.com', // host
11-
'your-api-key-here' // apiKey - Replace with your actual API key if needed
10+
host: 'https://demo.dotcms.com',
11+
apiKey: 'API_KEY',
1212
);
1313

1414
// Create a client
@@ -19,23 +19,23 @@
1919
echo "--------------------------------\n";
2020
$navRequest = $client->createNavigationRequest('/', 1);
2121
$nav = $client->getNavigation($navRequest);
22-
echo "Title: " . $nav['title'] . "\n";
23-
echo "URL: " . $nav['href'] . "\n";
24-
echo "Type: " . $nav['type'] . "\n\n";
22+
echo "Title: " . $nav->title . "\n";
23+
echo "URL: " . $nav->href . "\n";
24+
echo "Type: " . $nav->type . "\n\n";
2525

2626
// Example 2: Get navigation with children (depth=2)
2727
echo "Example 2: Navigation with children (depth=2)\n";
2828
echo "------------------------------------------\n";
29-
$navWithChildrenRequest = $client->createNavigationRequest('/about-us', 2);
29+
$navWithChildrenRequest = $client->createNavigationRequest('/application', 2);
3030
$navWithChildren = $client->getNavigation($navWithChildrenRequest);
31-
echo "Title: " . $navWithChildren['title'] . "\n";
32-
echo "URL: " . $navWithChildren['href'] . "\n";
33-
echo "Type: " . $navWithChildren['type'] . "\n";
31+
echo "Title: " . $navWithChildren->title . "\n";
32+
echo "URL: " . $navWithChildren->href . "\n";
33+
echo "Type: " . $navWithChildren->type . "\n";
3434

3535
if ($navWithChildren->hasChildren()) {
3636
echo "Children:\n";
3737
foreach ($navWithChildren->getChildren() as $child) {
38-
echo "- " . $child['title'] . " (" . $child['href'] . ")\n";
38+
echo "- " . $child->title . " (" . $child->href . ")\n";
3939
}
4040
}
4141
echo "\n";
@@ -45,21 +45,21 @@
4545
echo "-------------------------------------------\n";
4646
$navSpanishRequest = $client->createNavigationRequest('/', 1, 2);
4747
$navSpanish = $client->getNavigation($navSpanishRequest);
48-
echo "Title: " . $navSpanish['title'] . "\n";
49-
echo "URL: " . $navSpanish['href'] . "\n";
50-
echo "Language ID: " . $navSpanish['languageId'] . "\n\n";
48+
echo "Title: " . $navSpanish->title . "\n";
49+
echo "URL: " . $navSpanish->href . "\n";
50+
echo "Language ID: " . $navSpanish->languageId . "\n\n";
5151

5252
// Example 4: Async navigation request
5353
echo "Example 4: Async navigation request\n";
5454
echo "--------------------------------\n";
55-
$asyncRequest = $client->createNavigationRequest('/about-us', 2);
55+
$asyncRequest = $client->createNavigationRequest('/application', 2);
5656
$client->getNavigationAsync($asyncRequest)->then(
5757
function ($nav) {
58-
echo "Title: " . $nav['title'] . "\n";
58+
echo "Title: " . $nav->title . "\n";
5959
if ($nav->hasChildren()) {
6060
echo "Children:\n";
6161
foreach ($nav->getChildren() as $child) {
62-
echo "- " . $child['title'] . "\n";
62+
echo "- " . $child->title . "\n";
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)