Skip to content

Commit

Permalink
feat: support site sets for typo3 v13
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Jan 8, 2025
1 parent dc8a35d commit 017f3fd
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .ddev/commands/web/.install-13
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ setup_typo3

sed -i "/'deprecations'/,/^[[:space:]]*'disabled' => true,/s/'disabled' => true,/'disabled' => false,/" /var/www/html/.test/$VERSION/config/system/settings.php

add_typoscript_set
add_site_set
update_typo3
20 changes: 17 additions & 3 deletions .ddev/commands/web/.utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function setup_environment() {
local version=$1
BASE_PATH="/var/www/html/.test/$version"
rm -rf "$BASE_PATH"
mkdir -p "$BASE_PATH/src/$EXTENSION_KEY"
mkdir -p "$BASE_PATH/packages/$EXTENSION_KEY"
chmod 775 -R $BASE_PATH
export DATABASE="database_$version"
export BASE_PATH
Expand All @@ -93,14 +93,14 @@ function create_symlinks_main_extension() {
continue 2
fi
done
ln -sr "$item" "$BASE_PATH/src/$EXTENSION_KEY/$base_name"
ln -sr "$item" "$BASE_PATH/packages/$EXTENSION_KEY/$base_name"
done
}

function setup_composer() {
composer init --name="xima/typo3-$VERSION" --description="TYPO3 $VERSION" --no-interaction --working-dir "$BASE_PATH"
composer config extra.typo3/cms.web-dir public --working-dir "$BASE_PATH"
composer config repositories.src path 'src/*' --working-dir "$BASE_PATH"
composer config repositories.packages path 'packages/*' --working-dir "$BASE_PATH"
composer config --no-interaction allow-plugins.typo3/cms-composer-installers true --working-dir "$BASE_PATH"
composer config --no-interaction allow-plugins.typo3/class-alias-loader true --working-dir "$BASE_PATH"
}
Expand Down Expand Up @@ -128,6 +128,20 @@ function add_typoscript_set() {
mysql -uroot -proot $DATABASE -e 'UPDATE sys_template SET include_static_file = CONCAT(include_static_file, ",EXT:xima_typo3_frontend_edit/Configuration/TypoScript") WHERE uid = 1;'
}

function add_site_set() {
yaml_file="$BASE_PATH/config/sites/main/config.yaml"

lines_to_add="dependencies:
- typo3/fluid-styled-content
- typo3/fluid-styled-content-css
- xima/xima-typo3-frontend-edit"

if ! grep -q "xima/xima-typo3-frontend-edit" "$yaml_file"; then
echo "$lines_to_add" >> "$yaml_file"
fi
mysql -uroot -proot $DATABASE -e 'UPDATE sys_template SET clear = 0 WHERE uid = 1;'
}

message() {
local color=$1
local message=$2
Expand Down
39 changes: 27 additions & 12 deletions .ddev/commands/web/typo3
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
#!/bin/bash

## Description: [ExtDev] Exec TYPO3 command for all available TYPO3 integration instances.
## Description: Exec TYPO3 command for all available TYPO3 integration instances or a selected TYPO3 instance.
## Usage: typo3
## Example: "ddev typo3 cache:flush" or "ddev typo3 database:schemaupdate"
## Example: "ddev typo3 cache:flush" or "ddev typo3 database:schemaupdate" or "ddev typo3 11 cache:flush"

. .ddev/commands/web/.utils.sh

command=$1

mapfile -t versions < <(get_supported_typo3_versions)
for version in "${versions[@]}"; do
TYPO3_PATH=".test/${version}/vendor/bin/typo3"
if [ -f "$TYPO3_PATH" ]; then
message magenta "[TYPO3 v${version}] ${command}"
/usr/bin/php $TYPO3_PATH $command
else
message red "TYPO3 binary not found for version ${version}"
fi
done

if [[ "$command" =~ ^[0-9]+$ ]] && [[ " ${versions[@]} " =~ " ${command} " ]]; then
version=$command
command=$2
TYPO3_PATH=".test/${version}/vendor/bin/typo3"
if [ -f "$TYPO3_PATH" ]; then
message magenta "[TYPO3 v${version}] ${command}"
/usr/bin/php $TYPO3_PATH $command
else
message red "TYPO3 binary not found for version ${version}"
fi
else
for version in "${versions[@]}"; do
TYPO3_PATH=".test/${version}/vendor/bin/typo3"
if [ -f "$TYPO3_PATH" ]; then
message magenta "[TYPO3 v${version}] ${command}"
/usr/bin/php $TYPO3_PATH $command
else
message red "TYPO3 binary not found for version ${version}"
fi
done
fi



2 changes: 2 additions & 0 deletions Configuration/Sets/XimaTypo3FrontendEdit/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: xima/xima-typo3-frontend-edit
label: Frontend Edit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'EXT:xima_typo3_frontend_edit/Configuration/TypoScript/constants.typoscript'
1 change: 1 addition & 0 deletions Configuration/Sets/XimaTypo3FrontendEdit/setup.typoscript
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'EXT:xima_typo3_frontend_edit/Configuration/TypoScript/setup.typoscript'
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,22 @@ Include the static TypoScript template "Frontend edit" or directly import it in
@import 'EXT:xima_typo3_frontend_edit/Configuration/TypoScript/setup.typoscript'
```

Adjust the constants to restrict the usage of the frontend edit:
> TYPO3 13: Include the Frontend Edit (`xima/xima-typo3-frontend-edit`) site set.
### Adjustments

Adjust the typoscript constants to restrict the usage of the frontend edit:

``` typoscript
plugin.tx_ximatypo3frontendedit {
settings {
# Ignore content elements by several criteria
ignorePids =
ignoreCTypes =
ignoreListTypes =
ignoreUids =
# Adjust the default menu structure by setting an entry to "0" to disable it
defaultMenuStructure {
div_info =
header =
Expand All @@ -70,6 +76,8 @@ plugin.tx_ximatypo3frontendedit {
}
```

### User settings

Backend user can easily disable the whole frontend edit functionality within their user settings.

*User Settings > Edit and advanced functions > Disable frontend edit*
Expand Down Expand Up @@ -263,10 +271,10 @@ This could be caused by a strict referer header in your request. If the return u

## Development

Use the following ddev command to easily install all support TYPO3 versions for locale development.
Use the following ddev command to easily install all supported TYPO3 versions for locale development.

```bash
ddev install all
$ ddev install all
```

## License
Expand Down

0 comments on commit 017f3fd

Please sign in to comment.