Configuration

Everything on the plugin's Settings page can also be managed via PHP in a config file. Set these values in config/matrix-block-anchor.php and they take precedence over whatever's set in the control panel.

Start by creating a config/matrix-block-anchor.php file. It's multi-environment aware too, so you can have different settings per environment, the same as you would with general.php.

return [
    'anchorPrefix' => 'blockIdAnchor',
    'allowCustomAnchors' => false,
    'useLegacySeparator' => false,
];
config/matrix-block-anchor.php

You can also pass in environment values using the App::env PHP method.

use craft\helpers\App;

return [
    'anchorPrefix' => App::env('BLOCK_ANCHOR_PREFIX'),
    'allowCustomAnchors' =>  App::env('BLOCK_ALLOW_CUSTOM_ANCHORS'),
    'useLegacySeparator' =>  App::env('BLOCK_USE_LEGACY_SEPARATOR'),
];
config/matrix-block-anchor.php

Then add these values to your .env file

# Matrix Block Anchor Settings
BLOCK_ANCHOR_PREFIX="blockIdAnchor"
BLOCK_ALLOW_CUSTOM_ANCHORS=1
BLOCK_USE_LEGACY_SEPARATOR=0
.env