Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom label for submit button #109

Merged
merged 2 commits into from
Nov 16, 2024
Merged

Allow custom label for submit button #109

merged 2 commits into from
Nov 16, 2024

Conversation

dregad
Copy link
Owner

@dregad dregad commented Nov 10, 2024

By specifying {{NEWPAGE?label=xxxx}}, it is now possible to set a
custom label on the Add New Page form's submit button, instead of using
the Add page default.

The specified value for the label parameter is a DokuWiki language
string, allowing localization; if no matching translation is found, then
xxxx will be displayed as-is.

Fixes #108

@dregad dregad changed the base branch from master to pr72 November 10, 2024 11:45
By specifying `{{NEWPAGE?label=xxxx}}`, it is now possible to set a
custom label on the Add New Page form's submit button, instead of using
the `Add page` default.

The specified value for the *label* parameter is a DokuWiki language
string, allowing localization; if no matching translation is found, then
`xxxx` will be displayed as-is.

Fixes #108
@dregad
Copy link
Owner Author

dregad commented Nov 10, 2024

@Whyglobaleyes is this what you had in mind ?

From your examples in #108:

{{NEWPAGE>journal:%Y.%m.%d?autopage&label=New_Journal_Page}}
{{NEWPAGE>log:%Y.%m.%d?autopage&label=New_Log_Page}}

Render like this:
image

It is also possible to localize the labels so it adapts to the user's language, as explained here:
https://www.dokuwiki.org/localization#changing_some_localized_texts_and_strings_in_your_installation

For example:
Set {{NEWPAGE?label=custom}} and define custom label language string in conf/plugin_lang/addnewpage/en/lang.php

<?php
$lang['custom'] = "Custom Label";

image

@Whyglobaleyes
Copy link

Many Thanks @dregad,

Apologies it took me a few days to figure out where to find your updated patch/ PR.

This works exactly as expected thank you.

There is one oddity - perhaps an incompatibility with the original PR72. I think this screenshot shows that I couldn't get the label switch to work with the autopage switch. I tried a few variations but am I using incorrect syntax please?

tia
ygi

Screenshot_2024-11-12_21-08-58

@dregad
Copy link
Owner Author

dregad commented Nov 13, 2024

{{NEWPAGE>wiki:%Y-%m-%d?autopage?label=wiki}}

The syntax is indeed incorrect. The options are built like an URL, so you should start with a "?" and the next separators should be "&" whereas you put another "?" instead.

This is explained here: https://www.dokuwiki.org/plugin:addnewpage#configuration_overrides

Correct syntax:

{{NEWPAGE>wiki:%Y-%m-%d?autopage&label=wiki}}

@dregad dregad merged commit 5e302d5 into pr72 Nov 16, 2024
@dregad dregad deleted the custom-label branch November 16, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query: Possible to customise the "Add page" button label
2 participants