Skip to content

Commit

Permalink
[FEATURE] Introduce Site Settings Editor (#148)
Browse files Browse the repository at this point in the history
Introduce site settings for the blog_example as demonstration

References: TYPO3-Documentation/Changelog-To-Doc#1026
Release: main
  • Loading branch information
linawolf authored Sep 13, 2024
1 parent 82d2e52 commit 4333044
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 62 deletions.
31 changes: 0 additions & 31 deletions Configuration/Sets/BlogExample/constants.typoscript

This file was deleted.

59 changes: 59 additions & 0 deletions Configuration/Sets/BlogExample/settings.definitions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
categories:
BlogExample:
label: 'Blog Example'
BlogExample.templates:
label: 'Templates'
parent: BlogExample
BlogExample.pages:
label: 'Pages'
parent: BlogExample
BlogExample.layout:
label: 'Layout'
parent: BlogExample
BlogExample.settings:
label: 'Settings'
parent: BlogExample

settings:
blogExample.templateRootPath:
label: 'Templates'
category: BlogExample.templates
description: 'Path to template root'
type: string
default: 'EXT:blog_example/Resources/Private/Templates/'
blogExample.partialRootPath:
label: 'Partials'
category: BlogExample.templates
description: 'Path to partial root'
type: string
default: 'EXT:blog_example/Resources/Private/Partials/'
blogExample.layoutRootPath:
label: 'Layouts'
category: BlogExample.templates
description: 'Path to layout root'
type: string
default: 'EXT:blog_example/Resources/Private/Layouts/'
blogExample.storagePid:
label: 'Default storage PID'
category: BlogExample.pages
description: 'Folder that stores all blogs, blog-posts and comments'
type: int
default: 0
blogExample.editorUsergroupUid:
label: 'Frontend admin user group UID'
category: BlogExample.settings
description: 'Enter the uid of the front end user group that should be allowed to edit blogs and post in the frontend in the admin plugin. '
type: int
default: 0
blogExample.postsPerPage:
label: 'Posts per page'
category: BlogExample.settings
description: 'How many posts should be displayed per page of pagination?'
type: int
default: 3
blogExample.defaultGravator:
label: 'Default gravator icon'
category: BlogExample.layout
description: 'This icon is displayed for a comment if the email address of the commentary is not registered. '
type: string
default: 'EXT:blog_example/Resources/Public/Icons/default_gravatar.gif'
35 changes: 7 additions & 28 deletions Configuration/Sets/BlogExample/setup.typoscript
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
# Plugin configuration
plugin.tx_blogexample {
settings {
# maximum number of posts to display per page
postsPerPage = 3
# Editor FE Usergroup uid
editorUsergroupUid = {$plugin.tx_blogexample.settings.editorUsergroupUid}
# Plaintext page type number
plaintextPageType = {$plugin.tx_blogexample.settings.plaintextPageType}
rss {
channel {
typeNum = {$plugin.tx_blogexample.settings.rssPageType}
title = The RSS feed
}
}
postsPerPage = {$blogExample.postsPerPage}
editorUsergroupUid = {$blogExample.editorUsergroupUid}
defaultGravator = {$blogExample.defaultGravator}
}

persistence {
storagePid = {$plugin.tx_blogexample.persistence.storagePid}
storagePid = {$blogExample.storagePid}
}

view {
templateRootPaths.10 = {$plugin.tx_blogexample.view.templateRootPath}
partialRootPaths.10 = {$plugin.tx_blogexample.view.partialRootPath}
layoutRootPaths.10 = {$plugin.tx_blogexample.view.layoutRootPath}
templateRootPaths.10 = {$blogExample.templateRootPath}
partialRootPaths.10 = {$blogExample.partialRootPath}
layoutRootPaths.10 = {$blogExample.layoutRootPath}
defaultPid = auto
}

Expand All @@ -34,18 +25,6 @@ plugin.tx_blogexample {
}
}

# Module configuration
module.tx_blogexample {
settings < plugin.tx_blogexample.settings
persistence < plugin.tx_blogexample.persistence
view < plugin.tx_blogexample.view
view {
templateRootPaths.10 = {$module.tx_blogexample.view.templateRootPath}
partialRootPaths.10 = {$module.tx_blogexample.view.partialRootPath}
layoutRootPaths.10 = {$module.tx_blogexample.view.layoutRootPath}
}
}

# Make postlist available as lib.blog_example_post_list

lib.blog_example_post_list < tt_content.list.20.blogexample_postlist
Expand Down
18 changes: 18 additions & 0 deletions Configuration/Sets/RssFeed/settings.definitions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
categories:
BlogExample.rss:
label: 'RSS feed'
parent: BlogExample

settings:
blogExampleRss.page_type:
label: 'RSS page type'
category: BlogExample.rss
description: 'If the default RSS page type number (778) conflicts with your setup, you can override this setting here. '
type: int
default: 778
blogExampleRss.title:
label: 'Title of the RSS feed'
category: BlogExample.rss
description: 'Path to template root'
type: string
default: 'The RSS feed'
14 changes: 12 additions & 2 deletions Configuration/Sets/RssFeed/setup.typoscript
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
plugin.tx_blogexample {
settings {
rss {
channel {
typeNum = {$blogExampleRss.page_type}
title = {$blogExampleRss.title}
}
}
}
}
# RSS rendering
tx_blogexample_rss = PAGE
tx_blogexample_rss {
typeNum = {$plugin.tx_blogexample.settings.rssPageType}
10 < tt_content.list.20.blogexample_postlistrss
typeNum = {$blogExampleRss.page_type}
10 < tt_content.blogexample_postlistrss

config {
disableAllHeaderCode = 1
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Templates/Post/Show.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2>
<li>
<blog:gravatar
emailAddress="{comment.email}"
defaultImageUri="{f:uri.resource(path: 'EXT:blog_example/Resources/Public/Icons/default_gravatar.gif', absolute: 1)}"
defaultImageUri="{f:uri.resource(path: '{settings.defaultGravator}', absolute: 1)}"
size="40"
class="tx-blogexample-gravatar"
alt="Gravator icon of {comment.author}"
Expand Down
11 changes: 11 additions & 0 deletions ext_typoscript_constants.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

module.tx_blogexample {
view {
# cat=module.tx_blogexample/file; type=string; label=Path to template root (BE)
templateRootPath = EXT:blog_example/Resources/Private/Backend/Templates/
# cat=module.tx_blogexample/file; type=string; label=Path to template partials (BE)
partialRootPath = EXT:blog_example/Resources/Private/Partials/
# cat=module.tx_blogexample/file; type=string; label=Path to template layouts (BE)
layoutRootPath = EXT:blog_example/Resources/Private/Backend/Layouts/
}
}
12 changes: 12 additions & 0 deletions ext_typoscript_setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Module configuration
module.tx_blogexample {
settings < plugin.tx_blogexample.settings
persistence < plugin.tx_blogexample.persistence
view < plugin.tx_blogexample.view
view {
templateRootPaths.10 = {$module.tx_blogexample.view.templateRootPath}
partialRootPaths.10 = {$module.tx_blogexample.view.partialRootPath}
layoutRootPaths.10 = {$module.tx_blogexample.view.layoutRootPath}
}
}

0 comments on commit 4333044

Please sign in to comment.