Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes for Craft User Manual

## dev-main - 2025-06-04
- Fixed issue where date created dictated the default entry displayed when user clicked into the User Manual. Previously, the default entry was the entry with the oldest creation date. Now, if the user manual section is defined as a structure, the order as selected in the structure will dictate the initial item displayed.
- Fixed the logic in the default template to display the help message to the developer when the user manual entry did not contain a field with the handle `body`.
- Added support for custom `cpTrigger`.

## 5.0.4 - 2025-02-05
- Adding in ability to add a custom URL segment to the user manual documentation section.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hillholliday/craft-user-manual",
"description": "Craft User Manual allows developers (or even content editors) to provide CMS documentation using Craft's built-in sections (singles, channels, or structures) to create a `User Manual` or `Help` section directly in the control panel.",
"type": "craft-plugin",
"version": "5.0.4",
"version": "dev-main",
"keywords": [
"craft",
"cms",
Expand Down
6 changes: 5 additions & 1 deletion src/UserManual.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ function (Event $event) {
public function getCpNavItem(): ?array
{
$item = parent::getCpNavItem();
$item['url'] = '/admin/' . $this->getSettings()->urlSegment;

// get the cpTrigger from the config
$cpTrigger = Craft::$app->getConfig()->getGeneral()->cpTrigger;

$item['url'] = $cpTrigger . '/' . $this->getSettings()->urlSegment;
return $item;
}

Expand Down
18 changes: 11 additions & 7 deletions src/templates/_body.twig
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{# Using bracket notation for an accurate test, due to
a Twig bug: http://craftcms.stackexchange.com/questions/2116/twig-is-defined-always-returning-true/2117#2117 #}

{% if entry['body'] is defined %}
{{ entry.body }}
{% if entry.body %}
{{ entry.body }}
{% else %}
<p>
<a href="{{ url('settings/fields/new') }}">Create a field</a> with the handle of <code>body</code>
<b>or</b>
use the <a href="{{ url('settings/plugins/usermanual#settings-templateOverride-field') }}">Template Override</a> option to define your own fields.
</p>
<p>
<a href="{{ url('settings/fields/new') }}">Create a field</a>
with the handle of
<code>body</code>
<b>or</b>
use the
<a href="{{ url('settings/plugins/usermanual#settings-templateOverride-field') }}">Template Override</a>
option to define your own fields.
</p>
{% endif %}
3 changes: 1 addition & 2 deletions src/twigextensions/UserManualTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ public function getHelpDocument(): string
// Get the first entry in the section when viewing the base URL
$criteria = [
'sectionId' => $sectionId,
'limit' => 1,
'orderBy' => 'dateCreated ASC'
'limit' => 1
];
} else {
$criteria = [
Expand Down