'."\n";
$toc .= ''."\n";
return [$toc, $content];
}
/**
* Safely extracts value from Statamic Value objects
*/
private function valueGet($value)
{
if ($value instanceof \Statamic\Fields\Value) {
return $value->value();
}
return $value;
}
private function slugify($text)
{
$slugified = Statamic::modify($text)->replace('&', '')->slugify()->stripTags();
// Remove 'code-code' from the slugified text e.g. Otherwise "the `@` ignore symbol" gets converted to `the-code-code-ignore-symbol`
$slugified = str_replace('code-code-', '', $slugified);
// Remove HTML entity remnants that might be left after processing
// Only remove these if they appear as standalone words or at word boundaries
$slugified = preg_replace('/\b(codelt|rt|gtcode)\b/', '', $slugified);
return $slugified;
}
}
================================================
FILE: app/Providers/AppServiceProvider.php
================================================
runningConsoleCommand('search:update')) {
TorchlightOptions::setDefaultOptionsBuilder(fn () => TorchlightOptions::fromArray(config('torchlight.options')));
$extension = new TorchlightExtension(config('torchlight.theme'));
$extension
->renderer()
->setDefaultGrammar(config('torchlight.options.defaultLanguage'));
Markdown::addExtension(fn () => $extension);
}
Event::listen(SearchEntriesCreated::class, SearchEntriesCreatedListener::class);
StorybookSearchProvider::register();
}
}
================================================
FILE: app/Search/DocTransformer.php
================================================
lower()
->explode(' ')
->map(fn ($word) => Str::singular($word))
->join(' ');
}
public function handle(DocumentFragment $fragment, $entry): void
{
$fragment->additionalContextData[] = $this->normalizeConent($entry->title);
// Add some extra details to "additional_context"
if (Str::containsAll($fragment->content, ['clear', 'cache'])) {
$fragment->additionalContextData[] = 'delete cache';
}
if (Str::contains($fragment->content, 'JS Drivers')) {
$fragment->additionalContextData[] = 'javascript drivers';
}
}
}
================================================
FILE: app/Search/Listeners/SearchEntriesCreatedListener.php
================================================
level;
for ($i = array_search($target, $headers) - 1; $i >= 0; $i--) {
$header = $headers[$i];
if ($header->level < $currentLevel) {
$hierarchy[] = $header;
$currentLevel = $header->level;
}
}
foreach (array_reverse($hierarchy) as $level) {
$levels[$level->level] = str($level->text)->replaceEnd('#', '')->__toString();
}
return $levels;
}
/**
* Handle the event.
*/
public function handle(SearchEntriesCreated $event): void
{
$collection = $event->entry->collection()->title;
$headers = [];
foreach ($event->sections as $section) {
if ($section->fragment->headerDetails == null) {
continue;
}
$headers[] = $section->fragment->headerDetails;
}
foreach ($event->sections as $section) {
$data = $section->searchEntry->data();
$data['search_title'] = str($data['search_title'] ?? '')->replaceEnd('#', '')->__toString();
$category = match (true) {
$collection === 'Pages' => ($event->entry->parent() ? $event->entry->parent()?->title.' » ' : null).$data['origin_title'],
default => $collection.' » '.$data['origin_title'],
};
$parentHeadings = null;
if (
$section->fragment->headerDetails != null &&
$section->fragment->headerDetails->level >= 3
) {
$header = $section->fragment->headerDetails;
$parentHeadings = $this->getParentHeadings(
$headers,
$header
);
$parentHeadings[$header->level] = $header->text;
}
if ($parentHeadings === null) {
$parentHeadings = [];
if ($data['search_title'] != null && $data['origin_title'] != $data['search_title']) {
$parentHeadings[1] = $data['search_title'];
}
}
if (count($parentHeadings) > 2) {
array_shift($parentHeadings);
}
$data['hierarchy_lvl0'] = $category;
$data['hierarchy_lvl1'] = str(implode(' » ', $parentHeadings))->replaceEnd('#', '')->__toString();
if ($data['is_root']) {
$data['content'] = strip_tags($event->entry->intro ?? $event->entry->description ?? $data['search_content']);
} else {
$data['content'] = $data['search_content'] ?? '';
}
$data['url'] = $data['search_url'];
foreach ($this->escapeProperties as $property) {
if (! $data->has($property)) {
continue;
}
$data[$property] = e($data[$property]);
}
// Clear this out to prevent "too much" from a specific page dominating the results.
if (! $data['is_root']) {
$data['origin_title'] = null;
}
$section->searchEntry->data($data);
}
}
}
================================================
FILE: app/Search/RequestContentRetriever.php
================================================
instance('request', $request);
Cascade::withRequest($request);
});
$content = '';
try {
$content = $entry->toResponse($request)->getContent();
} finally {
app()->instance('request', $originalRequest);
}
return $this->extractArticleContent($content);
}
protected function extractArticleContent(string $content): string
{
$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTML($content);
libxml_clear_errors();
$articles = $dom->getElementsByTagName('article');
$result = '';
foreach ($articles as $article) {
$result .= $dom->saveHTML($article);
}
return $result;
}
}
================================================
FILE: app/Search/Storybook/StorybookSearchProvider.php
================================================
collect('entries')
->filter(fn (array $story) => Str::endsWith($story['id'], ['--docs', '--default']))
->unique('title')
->map(fn (array $story) => StorybookSearchable::from($story))
->map->reference();
}
public function contains($searchable): bool
{
// TODO: Implement contains() method.
}
public function find(array $keys): Collection
{
$stories = Http::get('https://ui.statamic.dev/index.json')->collect('entries');
return collect($keys)->map(fn (string $key) => StorybookSearchable::from($stories->get($key)));
}
}
================================================
FILE: app/Search/Storybook/StorybookSearchable.php
================================================
id = $component['id'];
$instance->title = Str::after($component['title'], '/');
return $instance;
}
public function id(): string
{
return $this->id;
}
public function title(): string
{
return $this->title;
}
public function getSearchValue(string $field)
{
if ($field === 'title' || $field === 'origin_title' || $field === 'search_title') {
return $this->title();
}
if ($field === 'hierarchy_lvl0') {
return "UI Components » {$this->title()}";
}
if ($field === 'url') {
return $this->url();
}
return null;
}
public function url(): string
{
return "https://ui.statamic.dev/?path=/docs/{$this->id}";
}
public function reference(): string
{
return "storybook::{$this->id()}";
}
}
================================================
FILE: app/Tags/GithubCommitsUrl.php
================================================
context->get('id')) {
return false;
}
$content = Data::find($id);
if ($content instanceof \Statamic\Taxonomies\LocalizedTerm) {
return;
}
$path = Str::after($content->path(), 'content/');
return "https://github.com/statamic/docs/commits/{$this->getCurrentBranch()}/content/{$path}";
}
private function getCurrentBranch(): string
{
return collect(config('docs.versions'))
->where('version', config('docs.version'))
->first()['branch'] ?? '5.x';
}
}
================================================
FILE: app/Tags/GithubEditUrl.php
================================================
context->get('id')) {
return false;
}
$content = Data::find($id);
if ($content instanceof \Statamic\Taxonomies\LocalizedTerm) {
return;
}
$path = Str::after($path = $content->path(), 'content/');
return "https://github.com/statamic/docs/blob/{$this->getCurrentBranch()}/content/{$path}";
}
private function getCurrentBranch(): string
{
return collect(config('docs.versions'))
->where('version', config('docs.version'))
->first()['branch'] ?? '5.x';
}
}
================================================
FILE: app/Tags/HeroSponsors.php
================================================
addHour(), function () {
try {
return $this->sponsors()->collect()->where('price', '>=', 25);
} catch (\Exception $e) {
Log::error($e);
return collect(['error' => true]);
}
});
}
private function sponsors()
{
return LazyCollection::make(function () {
$cursor = null;
do {
$data = $this->request($cursor);
$sponsorships = Arr::get($data, 'data.viewer.organization.sponsorshipsAsMaintainer');
$cursor = $sponsorships['pageInfo']['endCursor'];
$hasNextPage = $sponsorships['pageInfo']['hasNextPage'];
yield from collect($sponsorships['nodes'])->map(fn ($sponsorship) => array_merge(
$sponsorship['sponsorEntity'],
['price' => $sponsorship['tier']['monthlyPriceInDollars']]
));
} while ($hasNextPage && $cursor);
});
}
private function request($cursor)
{
return Http::baseUrl('https://api.github.com')
->withToken(config('services.github.token'))
->asJson()
->accept('application/vnd.github.v4+json')
->withUserAgent('statamic/docs')
->post('/graphql', [
'query' => $this->query(),
'variables' => ['cursor' => $cursor],
])
->json();
}
private function query()
{
return <<<'GQL'
query($cursor: String) {
viewer {
organization(login: "statamic") {
sponsorshipsAsMaintainer(first: 100, after: $cursor, orderBy: {direction: ASC, field: CREATED_AT}) {
pageInfo {
hasNextPage
endCursor
}
nodes {
sponsorEntity {
... on User {
name
url
avatarUrl(size: 80)
}
... on Organization {
name
url
avatarUrl(size: 80)
}
}
tier {
name
monthlyPriceInDollars
}
}
}
}
}
}
GQL;
}
}
================================================
FILE: app/ViewModels/Fieldtypes.php
================================================
ucwords($this->cascade->get('title')).' Fieldtype'];
}
}
================================================
FILE: app/ViewModels/Modifiers.php
================================================
ucwords($this->cascade->get('title')).' Modifier'];
}
}
================================================
FILE: app/ViewModels/Tags.php
================================================
ucwords($this->cascade->get('slug')).' Tag'];
}
}
================================================
FILE: app/ViewModels/Variables.php
================================================
strtolower($this->cascade->get('slug'))];
}
}
================================================
FILE: artisan
================================================
#!/usr/bin/env php
handleCommand(new ArgvInput);
exit($status);
================================================
FILE: bootstrap/app.php
================================================
withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();
================================================
FILE: bootstrap/cache/.gitignore
================================================
*
!.gitignore
================================================
FILE: bootstrap/providers.php
================================================
env('APP_NAME', 'Statamic'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'file'),
],
];
================================================
FILE: config/auth.php
================================================
[
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "statamic", "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'statamic',
],
// 'users' => [
// 'driver' => 'eloquent',
// 'model' => env('AUTH_MODEL', User::class),
// ],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
'activations' => [
'provider' => 'users',
'table' => env('AUTH_ACTIVATION_TOKEN_TABLE', 'password_activation_tokens'),
'expire' => 4320,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];
================================================
FILE: config/cache.php
================================================
env('CACHE_STORE', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane",
| "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION', null),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
'static_cache' => [
'driver' => 'file',
'path' => storage_path('statamic/static-urls-cache'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
/*
|--------------------------------------------------------------------------
| Serializable Classes
|--------------------------------------------------------------------------
|
| This value determines the classes that can be unserialized from cache
| storage. By default, no PHP classes will be unserialized from your
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
*/
'serializable_classes' => false,
];
================================================
FILE: config/database.php
================================================
env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];
================================================
FILE: config/docs.php
================================================
env('STATAMIC_DOCS_VERSION', '6'),
'versions' => [
[
'version' => '6',
'branch' => '6.x',
'url' => 'https://statamic.dev',
],
[
'version' => '5',
'branch' => '5.x',
'url' => 'https://v5.statamic.dev',
],
],
];
================================================
FILE: config/filesystems.php
================================================
env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
// 'visibility' => 'public', // https://statamic.dev/assets#container-visibility
],
'assets' => [
'driver' => 'local',
'root' => public_path('img'),
'url' => '/img',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
================================================
FILE: config/logging.php
================================================
env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
================================================
FILE: config/mail.php
================================================
env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
],
];
================================================
FILE: config/queue.php
================================================
env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];
================================================
FILE: config/services.php
================================================
[
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'github' => [
'token' => env('GITHUB_TOKEN'),
],
];
================================================
FILE: config/session.php
================================================
env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This value controls the serialization strategy for session data, which
| is JSON by default. Setting this to "php" allows the storage of PHP
| objects in the session but can make an application vulnerable to
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
| Supported: "json", "php"
|
*/
'serialization' => 'json',
];
================================================
FILE: config/statamic/antlers.php
================================================
env('STATAMIC_ANTLERS_DEBUGBAR', true),
/*
|--------------------------------------------------------------------------
| Guarded Variables
|--------------------------------------------------------------------------
|
| Any variable pattern that appears in this list will not be allowed
| in any Antlers template, including any user-supplied values.
|
*/
'guardedVariables' => [
'config.app.key',
],
/*
|--------------------------------------------------------------------------
| Guarded Tags
|--------------------------------------------------------------------------
|
| Any tag pattern that appears in this list will not be allowed
| in any Antlers template, including any user-supplied values.
|
*/
'guardedTags' => [
],
/*
|--------------------------------------------------------------------------
| Guarded Modifiers
|--------------------------------------------------------------------------
|
| Any modifier pattern that appears in this list will not be allowed
| in any Antlers template, including any user-supplied values.
|
*/
'guardedModifiers' => [
],
];
================================================
FILE: config/statamic/api.php
================================================
env('STATAMIC_API_ENABLED', false),
'resources' => [
'collections' => false,
'navs' => false,
'taxonomies' => false,
'assets' => false,
'globals' => false,
'forms' => false,
'users' => false,
],
'route' => env('STATAMIC_API_ROUTE', 'api'),
/*
|--------------------------------------------------------------------------
| Authentication
|--------------------------------------------------------------------------
|
| By default, the API will be publicly accessible. However, you may define
| an API token here which will be used to authenticate requests.
|
*/
'auth_token' => env('STATAMIC_API_AUTH_TOKEN'),
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| Define the middleware / middleware group that will be applied to the
| API route group. If you want to externally expose this API, here
| you can configure a middleware-based authentication layer.
|
*/
'middleware' => env('STATAMIC_API_MIDDLEWARE', 'api'),
/*
|--------------------------------------------------------------------------
| Pagination
|--------------------------------------------------------------------------
|
| The numbers of items to show on each paginated page.
|
*/
'pagination_size' => 50,
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| By default, Statamic will cache each endpoint until the specified
| expiry, or until content is changed. See the documentation for
| more details on how to customize your cache implementation.
|
| https://statamic.dev/content-api#caching
|
*/
'cache' => [
'expiry' => 60,
],
/*
|--------------------------------------------------------------------------
| Exclude Keys
|--------------------------------------------------------------------------
|
| Here you may provide an array of keys to be excluded from API responses.
| For example, you may want to hide things like edit_url, api_url, etc.
|
*/
'excluded_keys' => [
//
],
];
================================================
FILE: config/statamic/assets.php
================================================
[
/*
|--------------------------------------------------------------------------
| Route Prefix
|--------------------------------------------------------------------------
|
| The route prefix for serving HTTP based manipulated images through Glide.
| If using the cached option, this should be the URL of the cached path.
|
*/
'route' => 'img',
/*
|--------------------------------------------------------------------------
| Require Glide security token
|--------------------------------------------------------------------------
|
| With this option enabled, you are protecting your website from mass image
| resize attacks. You will need to generate tokens using the Glide tag
| but may want to disable this while in development to tinker.
|
*/
'secure' => true,
/*
|--------------------------------------------------------------------------
| Image Manipulation Driver
|--------------------------------------------------------------------------
|
| The driver that will be used under the hood for image manipulation.
| Supported: "gd", "imagick" or a class name of a custom driver.
|
*/
'driver' => 'gd',
/*
|--------------------------------------------------------------------------
| Save Cached Images
|--------------------------------------------------------------------------
|
| Enabling this will make Glide save publicly accessible images. It will
| increase performance at the cost of the dynamic nature of HTTP based
| image manipulation. You will need to invalidate images manually.
|
*/
'cache' => false,
'cache_path' => public_path('img'),
/*
|--------------------------------------------------------------------------
| Image Manipulation Defaults
|--------------------------------------------------------------------------
|
| You may define global defaults for all manipulation parameters, such as
| quality, format, and sharpness. These can and will be overwritten
| on the tag parameter level as well as the preset level.
|
*/
'defaults' => [
// 'quality' => 50,
],
/*
|--------------------------------------------------------------------------
| Image Manipulation Presets
|--------------------------------------------------------------------------
|
| Rather than specifying your manipulation params in your templates with
| the glide tag, you may define them here and reference their handles.
| They may also be automatically generated when you upload assets.
| Containers can be configured to warm these caches on upload.
|
*/
'presets' => [
// 'small' => ['w' => 200, 'h' => 200, 'q' => 75, 'fit' => 'crop'],
],
/*
|--------------------------------------------------------------------------
| Generate Image Manipulation Presets on Upload
|--------------------------------------------------------------------------
|
| By default, presets will be automatically generated on upload, ensuring
| the cached images are available when they are first used. You may opt
| out of this behavior here and have the presets generated on demand.
|
*/
'generate_presets_on_upload' => true,
],
/*
|--------------------------------------------------------------------------
| Auto-Crop Assets
|--------------------------------------------------------------------------
|
| Enabling this will make Glide automatically crop assets at their focal
| point (which is the center if no focal point is defined). Otherwise,
| you will need to manually add any crop related parameters.
|
*/
'auto_crop' => true,
/*
|--------------------------------------------------------------------------
| Control Panel Thumbnail Restrictions
|--------------------------------------------------------------------------
|
| Thumbnails will not be generated for any assets any larger (in either
| axis) than the values listed below. This helps prevent memory usage
| issues out of the box. You may increase or decrease as necessary.
|
*/
'thumbnails' => [
'max_width' => 10000,
'max_height' => 10000,
],
/*
|--------------------------------------------------------------------------
| Control Panel Video Thumbnails
|--------------------------------------------------------------------------
|
| When enabled, Statamic will generate thumbnails for videos.
| Generated thumbnails are displayed in the Control Panel.
|
*/
'video_thumbnails' => true,
/*
|--------------------------------------------------------------------------
| File Previews with Google Docs
|--------------------------------------------------------------------------
|
| Filetypes that cannot be rendered with HTML5 can opt into the Google Docs
| Viewer. Google will get temporary access to these files so keep that in
| mind for any privacy implications: https://policies.google.com/privacy
|
*/
'google_docs_viewer' => false,
/*
|--------------------------------------------------------------------------
| Cache Metadata
|--------------------------------------------------------------------------
|
| Asset metadata (filesize, dimensions, custom data, etc) will get cached
| to optimize performance, so that it will not need to be constantly
| re-evaluated from disk. You may disable this option if you are
| planning to continually modify the same asset repeatedly.
|
*/
'cache_meta' => true,
/*
|--------------------------------------------------------------------------
| Focal Point Editor
|--------------------------------------------------------------------------
|
| When editing images in the Control Panel, there is an option to choose
| a focal point. When working with third-party image providers such as
| Cloudinary it can be useful to disable Statamic's built-in editor.
|
*/
'focal_point_editor' => true,
/*
|--------------------------------------------------------------------------
| Enforce Lowercase Filenames
|--------------------------------------------------------------------------
|
| Control whether asset filenames will be converted to lowercase when
| uploading and renaming. This can help you avoid file conflicts
| when working in case-insensitive filesystem environments.
|
*/
'lowercase' => true,
/*
|--------------------------------------------------------------------------
| Additional Uploadable Extensions
|--------------------------------------------------------------------------
|
| Statamic will only allow uploads of certain approved file extensions.
| If you need to allow more file extensions, you may add them here.
|
*/
'additional_uploadable_extensions' => [],
/*
|--------------------------------------------------------------------------
| Additional Filename Character Replacements
|--------------------------------------------------------------------------
|
| When uploading files, certain characters in filenames will be replaced
| to ensure a safe filename. You may configure additional replacements.
| These are in addition to the native ones. They are not overridable.
|
*/
'additional_filename_replacements' => [],
/*
|--------------------------------------------------------------------------
| SVG Sanitization
|--------------------------------------------------------------------------
|
| Statamic will automatically sanitize SVG files when uploaded to avoid
| potential security issues. However, if you have a valid reason for
| disabling this, and you trust your users, you may do so here.
|
*/
'svg_sanitization_on_upload' => true,
/*
|--------------------------------------------------------------------------
| FFmpeg
|--------------------------------------------------------------------------
|
| Statamic uses FFmpeg to extract thumbnails from videos to be shown in the
| Control Panel. You may adjust the binary location and cache path here.
|
*/
'ffmpeg' => [
'binary' => null,
'cache_path' => storage_path('statamic/glide/ffmpeg'),
],
/*
|--------------------------------------------------------------------------
| Replicator and Bard Set Preview Images
|--------------------------------------------------------------------------
|
| Replicator and Bard sets may have preview images to give users a visual
| representation of the content within. Here you may specify the asset
| container and folder where these preview images are to be stored.
|
*/
'set_preview_images' => [
'container' => 'assets',
'folder' => 'set-previews',
],
];
================================================
FILE: config/statamic/autosave.php
================================================
false,
/*
|--------------------------------------------------------------------------
| Default autosave interval
|--------------------------------------------------------------------------
|
| The default value may be set here and will apply to all collections.
| However, it is also possible to manually adjust the value in the
| each collection's config file. By default, this is set to 5s.
|
*/
'interval' => 5000,
];
================================================
FILE: config/statamic/cp.php
================================================
env('CP_ENABLED', true),
'route' => env('CP_ROUTE', 'cp'),
/*
|--------------------------------------------------------------------------
| Authentication
|--------------------------------------------------------------------------
|
| Whether the Control Panel's authentication pages should be enabled,
| and where users should be redirected in order to authenticate.
|
*/
'auth' => [
'enabled' => true,
'redirect_to' => null,
],
/*
|--------------------------------------------------------------------------
| Start Page
|--------------------------------------------------------------------------
|
| When a user logs into the Control Panel, they will be taken here.
| For example: "dashboard", "collections/pages", etc.
|
*/
'start_page' => 'dashboard',
/*
|--------------------------------------------------------------------------
| Dashboard Widgets
|--------------------------------------------------------------------------
|
| Here you may define any number of dashboard widgets. You're free to
| use the same widget multiple times in different configurations.
|
*/
'widgets' => [
//
],
/*
|--------------------------------------------------------------------------
| Pagination
|--------------------------------------------------------------------------
|
| Here you may define the default pagination size as well as the options
| the user can select on any paginated listing in the Control Panel.
|
*/
'pagination_size' => 50,
'pagination_size_options' => [10, 25, 50, 100, 500],
/*
|--------------------------------------------------------------------------
| Links to Documentation
|--------------------------------------------------------------------------
|
| Show contextual links to documentation throughout the Control Panel.
|
*/
'link_to_docs' => env('STATAMIC_LINK_TO_DOCS', true),
/*
|--------------------------------------------------------------------------
| Support Link
|--------------------------------------------------------------------------
|
| Set the location of the support link in the header.
|
*/
'support_url' => env('STATAMIC_SUPPORT_URL', 'https://statamic.com/support'),
/*
|--------------------------------------------------------------------------
| White Labeling
|--------------------------------------------------------------------------
|
| When in Pro Mode you may replace the Statamic name, logo, favicon,
| and add your own CSS to the control panel to match your
| company or client's brand.
|
*/
'custom_cms_name' => env('STATAMIC_CUSTOM_CMS_NAME', 'Statamic'),
'custom_logo_url' => env('STATAMIC_CUSTOM_LOGO_URL', null),
'custom_dark_logo_url' => env('STATAMIC_CUSTOM_DARK_LOGO_URL', null),
'custom_logo_text' => env('STATAMIC_CUSTOM_LOGO_TEXT', null),
'custom_favicon_url' => env('STATAMIC_CUSTOM_FAVICON_URL', null),
'custom_css_url' => env('STATAMIC_CUSTOM_CSS_URL', null),
/*
|--------------------------------------------------------------------------
| Thumbnails
|--------------------------------------------------------------------------
|
| Here you may define additional CP asset thumbnail presets.
|
*/
'thumbnail_presets' => [
// 'medium' => 800,
],
];
================================================
FILE: config/statamic/editions.php
================================================
env('STATAMIC_PRO_ENABLED', false),
'addons' => [
//
],
];
================================================
FILE: config/statamic/forms.php
================================================
resource_path('forms'),
/*
|--------------------------------------------------------------------------
| Email View Folder
|--------------------------------------------------------------------------
|
| The folder under resources/views where your email templates are found.
|
*/
'email_view_folder' => null,
/*
|--------------------------------------------------------------------------
| Send Email Job
|--------------------------------------------------------------------------
|
| The class name of the job that will be used to send an email.
|
*/
'send_email_job' => \Statamic\Forms\SendEmail::class,
/*
|--------------------------------------------------------------------------
| Exporters
|--------------------------------------------------------------------------
|
| Here you may define all the available form submission exporters.
| You may customize the options within each exporter's array.
|
*/
'exporters' => [
'csv' => [
'class' => Statamic\Forms\Exporters\CsvExporter::class,
],
'json' => [
'class' => Statamic\Forms\Exporters\JsonExporter::class,
],
],
];
================================================
FILE: config/statamic/git.php
================================================
env('STATAMIC_GIT_ENABLED', false),
/*
|--------------------------------------------------------------------------
| Automatically Run
|--------------------------------------------------------------------------
|
| By default, commits are automatically queued when `Saved` or `Deleted`
| events are fired. If you prefer users to manually trigger commits
| using the `Git` utility interface, you may set this to `false`.
|
| https://statamic.dev/git-automation#committing-changes
|
*/
'automatic' => env('STATAMIC_GIT_AUTOMATIC', true),
/*
|--------------------------------------------------------------------------
| Queue Connection
|--------------------------------------------------------------------------
|
| You may choose which queue connection should be used when dispatching
| commit jobs. Unless specified, the default connection will be used.
|
| https://statamic.dev/git-automation#queueing-commits
|
*/
'queue_connection' => env('STATAMIC_GIT_QUEUE_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Dispatch Delay
|--------------------------------------------------------------------------
|
| When `Saved` and `Deleted` events queue up commits, you may wish to
| set a delay time in minutes for each queued job. This can allow
| for more consolidated commits when you have multiple users
| making simultaneous content changes to your repository.
|
| Note: Not supported by default `sync` queue driver.
|
*/
'dispatch_delay' => env('STATAMIC_GIT_DISPATCH_DELAY', 0),
/*
|--------------------------------------------------------------------------
| Git User
|--------------------------------------------------------------------------
|
| The git user that will be used when committing changes. By default, it
| will attempt to commit with the authenticated user's name and email
| when possible, falling back to the below user when not available.
|
| https://statamic.dev/git-automation#git-user
|
*/
'use_authenticated' => true,
'user' => [
'name' => env('STATAMIC_GIT_USER_NAME', 'Spock'),
'email' => env('STATAMIC_GIT_USER_EMAIL', 'spock@example.com'),
],
/*
|--------------------------------------------------------------------------
| Tracked Paths
|--------------------------------------------------------------------------
|
| Define the tracked paths to be considered when staging changes. Default
| stache and file locations are already set up for you, but feel free
| to modify these paths to suit your storage config. Referencing
| absolute paths to external repos is also completely valid.
|
*/
'paths' => [
base_path('content'),
base_path('users'),
resource_path('addons'),
resource_path('blueprints'),
resource_path('fieldsets'),
resource_path('forms'),
resource_path('users'),
resource_path('preferences.yaml'),
resource_path('sites.yaml'),
storage_path('forms'),
public_path('assets'),
],
/*
|--------------------------------------------------------------------------
| Git Binary
|--------------------------------------------------------------------------
|
| By default, Statamic will try to use the "git" command, but you can set
| an absolute path to the git binary if necessary for your environment.
|
*/
'binary' => env('STATAMIC_GIT_BINARY', 'git'),
/*
|--------------------------------------------------------------------------
| Commands
|--------------------------------------------------------------------------
|
| Define a list commands to be run when Statamic is ready to `git add`
| and `git commit` your changes. These commands will be run once
| per repo, attempting to consolidate commits where possible.
|
| https://statamic.dev/git-automation#customizing-commits
|
*/
'commands' => [
'{{ git }} add {{ paths }}',
'{{ git }} -c "user.name={{ name }}" -c "user.email={{ email }}" commit -m "{{ message }}"',
],
/*
|--------------------------------------------------------------------------
| Push
|--------------------------------------------------------------------------
|
| Determine whether `git push` should be run after the commands above
| have finished. This is disabled by default, but can be enabled
| globally, or per environment using the provided variable.
|
| https://statamic.dev/git-automation#pushing-changes
|
*/
'push' => env('STATAMIC_GIT_PUSH', false),
/*
|--------------------------------------------------------------------------
| Ignored Events
|--------------------------------------------------------------------------
|
| Statamic will listen on all `Saved` and `Deleted` events, as well
| as any events registered by installed addons. If you wish to
| ignore any specific events, you may reference them here.
|
*/
'ignored_events' => [
// \Statamic\Events\UserSaved::class,
// \Statamic\Events\UserDeleted::class,
],
/*
|--------------------------------------------------------------------------
| Locale
|--------------------------------------------------------------------------
|
| The locale to be used when translating commit messages, etc. By
| default, the authenticated user's locale will be used, but
| feel free to override this using the provided variable.
|
*/
'locale' => env('STATAMIC_GIT_LOCALE', null),
];
================================================
FILE: config/statamic/graphql.php
================================================
env('STATAMIC_GRAPHQL_ENABLED', false),
'resources' => [
'collections' => false,
'navs' => false,
'taxonomies' => false,
'assets' => false,
'globals' => false,
'forms' => false,
'sites' => false,
'users' => false,
],
/*
|--------------------------------------------------------------------------
| Queries
|--------------------------------------------------------------------------
|
| Here you may list queries to be added to the Statamic schema.
|
| https://statamic.dev/graphql#custom-queries
|
*/
'queries' => [
//
],
/*
|--------------------------------------------------------------------------
| Mutations
|--------------------------------------------------------------------------
|
| Here you may list mutations to be added to the Statamic schema.
|
| https://statamic.dev/graphql#custom-mutations
*/
'mutations' => [
//
],
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| Here you may list middleware to be added to the Statamic schema.
|
| https://statamic.dev/graphql#custom-middleware
|
*/
'middleware' => [
//
],
/*
|--------------------------------------------------------------------------
| Caching
|--------------------------------------------------------------------------
|
| By default, Statamic will cache each request until the specified
| expiry, or until content is changed. See the documentation for
| more details on how to customize your cache implementation.
|
| https://statamic.dev/graphql#caching
|
*/
'cache' => [
'expiry' => 60,
],
/*
|--------------------------------------------------------------------------
| Introspection
|--------------------------------------------------------------------------
|
| Introspection queries allow a user to see the schema and will power
| development tools. This is "auto" by default, which will enable
| it locally and keep it disabled everywhere else for security.
|
*/
'introspection' => env('STATAMIC_GRAPHQL_INTROSPECTION_ENABLED', 'auto'),
];
================================================
FILE: config/statamic/live_preview.php
================================================
[
'Laptop' => ['width' => 1440, 'height' => 900],
'Tablet' => ['width' => 1024, 'height' => 786],
'Mobile' => ['width' => 375, 'height' => 812],
],
/*
|--------------------------------------------------------------------------
| Additional Inputs
|--------------------------------------------------------------------------
|
| Additional fields may be added to the Live Preview header bar. You
| may define a list of Vue components to be injected. Their values
| will be added to the cascade on the front-end for you to use.
|
*/
'inputs' => [
//
],
/*
|--------------------------------------------------------------------------
| Force Reload Javascript Modules
|--------------------------------------------------------------------------
|
| To force a reload, Live Preview appends a timestamp to the URL on
| script tags of type 'module'. You may disable this behavior here.
|
*/
'force_reload_js_modules' => true,
/*
|--------------------------------------------------------------------------
| Hot Reload Contents
|--------------------------------------------------------------------------
|
| Should the Live Preview embed be hot-reloaded when the content changes?
| Only applies when "Refresh" is disabled on the live preview target.
|
*/
'hot_reload_contents' => true,
];
================================================
FILE: config/statamic/markdown.php
================================================
[
'default' => [
'heading_permalink' => [
'id_prefix' => '',
'fragment_prefix' => '',
'apply_id_to_heading' => true,
'html_class' => 'c-anchor',
'aria_hidden' => false,
'insert' => 'after',
'symbol' => '#',
],
],
],
];
================================================
FILE: config/statamic/oauth.php
================================================
env('STATAMIC_OAUTH_ENABLED', false),
'email_login_enabled' => true,
'providers' => [
// 'github',
],
'routes' => [
'login' => 'oauth/{provider}',
'callback' => 'oauth/{provider}/callback',
],
/*
|--------------------------------------------------------------------------
| Create User
|--------------------------------------------------------------------------
|
| Whether or not a user account should be created upon authentication
| with an OAuth provider. If disabled, a user account will be need
| to be explicitly created ahead of time.
|
*/
'create_user' => true,
/*
|--------------------------------------------------------------------------
| Merge User Data
|--------------------------------------------------------------------------
|
| When authenticating with an OAuth provider, the user data returned
| such as their name will be merged with the existing user account.
|
*/
'merge_user_data' => true,
/*
|--------------------------------------------------------------------------
| Unauthorized Redirect
|--------------------------------------------------------------------------
|
| This controls where the user is taken after authenticating with
| an OAuth provider but their account is unauthorized. This may
| happen when the create_user option has been set to false.
|
*/
'unauthorized_redirect' => null,
/*
|--------------------------------------------------------------------------
| Remember Me
|--------------------------------------------------------------------------
|
| Whether or not the "remember me" functionality should be used when
| authenticating using OAuth. When enabled, the user will remain
| logged in indefinitely, or until they manually log out.
|
*/
'remember_me' => true,
];
================================================
FILE: config/statamic/protect.php
================================================
null,
/*
|--------------------------------------------------------------------------
| Protection Schemes
|--------------------------------------------------------------------------
|
| Here you may define all of the protection schemes for your application
| as well as their drivers. You may even define multiple schemes for
| the same driver to easily protect different types of pages.
|
| Supported drivers: "ip_address", "auth", "password"
|
*/
'schemes' => [
'ip_address' => [
'driver' => 'ip_address',
'allowed' => ['127.0.0.1'],
],
'logged_in' => [
'driver' => 'auth',
'login_url' => '/login',
'append_redirect' => true,
],
'password' => [
'driver' => 'password',
'allowed' => ['secret'],
'field' => null,
'form_url' => null,
],
],
];
================================================
FILE: config/statamic/revisions.php
================================================
env('STATAMIC_REVISIONS_ENABLED', false),
];
================================================
FILE: config/statamic/routes.php
================================================
true,
/*
|--------------------------------------------------------------------------
| Enable Route Bindings
|--------------------------------------------------------------------------
|
| Whether route bindings for Statamic repositories (entry, taxonomy,
| collections, etc) are enabled for front end routes. This may be
| useful if you want to make your own custom routes with them.
|
*/
'bindings' => false,
/*
|--------------------------------------------------------------------------
| Action Route Prefix
|--------------------------------------------------------------------------
|
| Some extensions may provide routes that go through the frontend of your
| website. These URLs begin with the following prefix. We've chosen an
| unobtrusive default but you are free to select whatever you want.
|
*/
'action' => '!',
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| Define the middleware that will be applied to the web route group.
|
*/
'middleware' => 'web',
];
================================================
FILE: config/statamic/search.php
================================================
env('STATAMIC_DEFAULT_SEARCH_INDEX', 'docs-'.config('docs.version')),
/*
|--------------------------------------------------------------------------
| Search Indexes
|--------------------------------------------------------------------------
|
| Here you can define all of the available search indexes.
|
*/
'indexes' => [
'docs-'.config('docs.version') => [
'driver' => env('SEARCH_DRIVER', 'meilisearch'),
'searchables' => ['docs:*', 'storybook:*'],
'fields' => [
'title',
'search_title',
'content',
'origin_title',
'search_content',
'additional_context',
'hierarchy_lvl0',
'hierarchy_lvl1',
'url',
],
'settings' => [
'rankingRules' => [
'words',
'typo',
'proximity',
'attribute',
'exactness',
'origin_title:desc',
'hierarchy_lvl0:asc',
],
'searchableAttributes' => [
'additional_context',
'hierarchy_lvl0',
'title',
'origin_title',
'search_title',
'search_content',
'hierarchy_lvl1',
'url',
],
],
'content_retriever' => App\Search\RequestContentRetriever::class,
'document_transformers' => [
App\Search\DocTransformer::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Driver Defaults
|--------------------------------------------------------------------------
|
| Here you can specify default configuration to be applied to all indexes
| that use the corresponding driver. For instance, if you have two
| indexes that use the "local" driver, both of them can have the
| same base configuration. You may override for each index.
|
*/
'drivers' => [
'local' => [
'path' => storage_path('statamic/search'),
],
'algolia' => [
'credentials' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', ''),
],
],
'meilisearch' => [
'credentials' => [
'url' => env('MEILISEARCH_HOST', 'http://localhost:7700'),
'secret' => env('MEILISEARCH_KEY', ''),
],
],
],
/*
|--------------------------------------------------------------------------
| Search Defaults
|--------------------------------------------------------------------------
|
| Here you can specify default configuration to be applied to all indexes
| regardless of the driver. You can override these per driver or per index.
|
*/
'defaults' => [
'fields' => ['title'],
],
/*
|--------------------------------------------------------------------------
| Indexing Queue
|--------------------------------------------------------------------------
|
| Here you may configure the queue name and connection used when indexing
| documents.
|
*/
'queue' => env('STATAMIC_SEARCH_QUEUE'),
'queue_connection' => env('STATAMIC_SEARCH_QUEUE_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Chunk Size
|--------------------------------------------------------------------------
|
| Here you can configure the chunk size used when indexing documents.
| The higher you make it, the more memory it will use, but the quicker
| the indexing process will be.
|
*/
'chunk_size' => 100,
];
================================================
FILE: config/statamic/stache.php
================================================
env('STATAMIC_STACHE_WATCHER', 'auto'),
/*
|--------------------------------------------------------------------------
| Cache Store
|--------------------------------------------------------------------------
|
| Here you may configure which Cache Store the Stache uses.
|
*/
'cache_store' => null,
/*
|--------------------------------------------------------------------------
| Stores
|--------------------------------------------------------------------------
|
| Here you may configure the stores that are used inside the Stache.
|
| https://statamic.dev/stache#stores
|
*/
'stores' => [
//
],
/*
|--------------------------------------------------------------------------
| Indexes
|--------------------------------------------------------------------------
|
| Here you may define any additional indexes that will be inherited
| by each store in the Stache. You may also define indexes on a
| per-store level by adding an "indexes" key to its config.
|
*/
'indexes' => [
//
],
/*
|--------------------------------------------------------------------------
| Locking
|--------------------------------------------------------------------------
|
| In order to prevent concurrent requests from updating the Stache at the
| same time and wasting resources, it will be locked so that subsequent
| requests will have to wait until the first one has been completed.
|
| https://statamic.dev/stache#locks
|
*/
'lock' => [
'enabled' => true,
'timeout' => 30,
],
/*
|--------------------------------------------------------------------------
| Warming Optimization
|--------------------------------------------------------------------------
|
| These options control performance optimizations during Stache warming.
|
*/
'warming' => [
// Enable parallel store processing for faster warming on multi-core systems
'parallel_processing' => env('STATAMIC_STACHE_PARALLEL_WARMING', false),
// Maximum number of parallel processes (0 = auto-detect CPU cores)
'max_processes' => env('STATAMIC_STACHE_MAX_PROCESSES', 0),
// Minimum number of stores required to enable parallel processing
'min_stores_for_parallel' => env('STATAMIC_STACHE_MIN_STORES_PARALLEL', 3),
// Concurrency driver: 'process', 'fork', or 'sync'
'concurrency_driver' => env('STATAMIC_STACHE_CONCURRENCY_DRIVER', 'process'),
],
];
================================================
FILE: config/statamic/static_caching.php
================================================
env('STATAMIC_STATIC_CACHING_STRATEGY', null),
/*
|--------------------------------------------------------------------------
| Caching Strategies
|--------------------------------------------------------------------------
|
| Here you may define all of the static caching strategies for your
| application as well as their drivers.
|
| Supported drivers: "application", "file"
|
*/
'strategies' => [
'half' => [
'driver' => 'application',
'expiry' => null,
],
'full' => [
'driver' => 'file',
'path' => public_path('static'),
'lock_hold_length' => 0,
'permissions' => [
'directory' => 0755,
'file' => 0644,
],
],
],
/*
|--------------------------------------------------------------------------
| Exclusions
|--------------------------------------------------------------------------
|
| Here you may define a list of URLs to be excluded from static
| caching. You may want to exclude URLs containing dynamic
| elements like contact forms, or shopping carts.
|
*/
'exclude' => [
'class' => null,
'urls' => [
'/sitemap.xml',
],
],
/*
|--------------------------------------------------------------------------
| Invalidation Rules
|--------------------------------------------------------------------------
|
| Here you may define the rules that trigger when and how content would be
| flushed from the static cache. See the documentation for more details.
| If a custom class is not defined, the default invalidator is used.
|
| https://statamic.dev/static-caching
|
*/
'invalidation' => [
'class' => null,
'rules' => [
//
],
],
/*
|--------------------------------------------------------------------------
| Ignoring Query Strings
|--------------------------------------------------------------------------
|
| Statamic will cache pages of the same URL but with different query
| parameters separately. This is useful for pages with pagination.
| If you'd like to ignore the query strings, you may do so.
|
*/
'ignore_query_strings' => false,
'allowed_query_strings' => [
//
],
'disallowed_query_strings' => [
//
],
/*
|--------------------------------------------------------------------------
| Nocache
|--------------------------------------------------------------------------
|
| Here you may define where the nocache data is stored.
|
| https://statamic.dev/tags/nocache#database
|
| Supported drivers: "cache", "database"
|
*/
'nocache' => 'cache',
'nocache_db_connection' => env('STATAMIC_NOCACHE_DB_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Replacers
|--------------------------------------------------------------------------
|
| Here you may define replacers that dynamically replace content within
| the response. Each replacer must implement the Replacer interface.
|
*/
'replacers' => [
\Statamic\StaticCaching\Replacers\CsrfTokenReplacer::class,
\Statamic\StaticCaching\Replacers\NoCacheReplacer::class,
],
/*
|--------------------------------------------------------------------------
| Warm Queue
|--------------------------------------------------------------------------
|
| Here you may define the queue name and connection
| that will be used when warming the static cache and
| optionally set the "--insecure" flag by default.
|
*/
'warm_queue' => env('STATAMIC_STATIC_WARM_QUEUE'),
'warm_queue_connection' => env('STATAMIC_STATIC_WARM_QUEUE_CONNECTION'),
'warm_insecure' => env('STATAMIC_STATIC_WARM_INSECURE', false),
/*
|--------------------------------------------------------------------------
| Background Re-cache
|--------------------------------------------------------------------------
|
| When this is enabled, Statamic will re-cache URLs in the background,
| overwriting the existing cache, without removing it first.
|
*/
'background_recache' => env('STATAMIC_BACKGROUND_RECACHE', false),
'recache_token' => env('STATAMIC_RECACHE_TOKEN'),
'recache_token_parameter' => '__recache',
/*
|--------------------------------------------------------------------------
| Shared Error Pages
|--------------------------------------------------------------------------
|
| You may choose to share the same statically generated error page across
| all errors. For example, the first time a 404 is encountered it will
| be generated and cached, and then served for all subsequent 404s.
|
| This is only supported for half measure.
|
*/
'share_errors' => false,
];
================================================
FILE: config/statamic/system.php
================================================
env('STATAMIC_LICENSE_KEY'),
/*
|--------------------------------------------------------------------------
| Enable Multi-site
|--------------------------------------------------------------------------
|
| Whether Statamic's multi-site functionality should be enabled. It is
| assumed Statamic Pro is also enabled. To get started, you can run
| the `php please multisite` command to update your content file
| structure, after which you can manage your sites in the CP.
|
| https://statamic.dev/multi-site
|
*/
'multisite' => false,
/*
|--------------------------------------------------------------------------
| Default Addons Paths
|--------------------------------------------------------------------------
|
| When generating addons via `php please make:addon`, this path will be
| used by default. You can still specify custom repository paths in
| your composer.json, but this is the path used by the generator.
|
*/
'addons_path' => base_path('addons'),
/*
|--------------------------------------------------------------------------
| Blueprints Path
|--------------------------------------------------------------------------
|
| Where your blueprint YAML files are stored.
|
*/
'blueprints_path' => resource_path('blueprints'),
/*
|--------------------------------------------------------------------------
| Fieldsets Path
|--------------------------------------------------------------------------
|
| Where your fieldset YAML files are stored.
|
*/
'fieldsets_path' => resource_path('fieldsets'),
/*
|--------------------------------------------------------------------------
| Send the Powered-By Header
|--------------------------------------------------------------------------
|
| Websites like builtwith.com use the X-Powered-By header to determine
| what technologies are used on a particular site. By default, we'll
| send this header, but you are absolutely allowed to disable it.
|
*/
'send_powered_by_header' => true,
/*
|--------------------------------------------------------------------------
| Date Format
|--------------------------------------------------------------------------
|
| This format will be used whenever a Carbon date is cast to a string on
| front-end routes. It doesn't affect how dates are formatted in the CP.
| You can customize this format using PHP's date string constants.
| Setting this value to null will use Carbon's default format.
|
| https://www.php.net/manual/en/function.date.php
|
*/
'date_format' => 'F jS, Y',
/*
|--------------------------------------------------------------------------
| Timezone
|--------------------------------------------------------------------------
|
| Statamic will use this timezone when displaying dates on the front-end.
| You can use any timezone supported by PHP. When set to null it will
| fall back to the timezone defined in your `app.php` config file.
|
| https://www.php.net/manual/en/timezones.php
|
*/
'display_timezone' => null,
/*
|--------------------------------------------------------------------------
| Localize Dates in Modifiers
|--------------------------------------------------------------------------
|
| When using date-related modifiers, Carbon instances will be in UTC.
| Enabling this setting will ensure that dates get localized into
| the timezone defined in `display_timezone`. Otherwise you'll
| need to manually localize dates in all of your templates.
|
*/
'localize_dates_in_modifiers' => true,
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| Statamic will use this character set when performing specific string
| encoding and decoding operations; This does not apply everywhere.
|
*/
'charset' => 'UTF-8',
/*
|--------------------------------------------------------------------------
| Track Last Update
|--------------------------------------------------------------------------
|
| Statamic will automatically set an `updated_at` timestamp (along with
| `updated_by`, where applicable) when specific content is updated.
| In some situations, you may wish disable this functionality.
|
*/
'track_last_update' => false,
/*
|--------------------------------------------------------------------------
| Enable Cache Tags
|--------------------------------------------------------------------------
|
| Sometimes you'll want to be able to disable the {{ cache }} tags in
| Antlers, so here is where you can do that. Otherwise, it will be
| enabled all the time.
|
*/
'cache_tags_enabled' => env('STATAMIC_CACHE_TAGS_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Intensive Operations
|--------------------------------------------------------------------------
|
| Sometimes Statamic requires extra resources to complete intensive
| operations. Here you may configure system resource limits for
| those rare times when we need to turn things up to eleven!
|
*/
'php_memory_limit' => '-1',
'php_max_execution_time' => '-1',
'ajax_timeout' => '600000',
'pcre_backtrack_limit' => '-1',
/*
|--------------------------------------------------------------------------
| Debugbar Integration
|--------------------------------------------------------------------------
|
| Statamic integrates with Laravel Debugbar to bring more detail to your
| debugging experience. Here you may adjust various default options.
|
*/
'debugbar' => [
'pretty_print_variables' => true,
],
/*
|--------------------------------------------------------------------------
| ASCII
|--------------------------------------------------------------------------
|
| During various string manipulations (e.g. slugification), Statamic will
| need to make ASCII character conversions. Here you may define whether
| or not extra characters get converted. e.g. "%" becomes "percent".
|
*/
'ascii_replace_extra_symbols' => false,
/*
|--------------------------------------------------------------------------
| Update References on Change
|--------------------------------------------------------------------------
|
| With this enabled, Statamic will attempt to update references to assets
| and terms when moving, renaming, replacing, deleting, etc. This will
| be queued, but it can disabled as needed for performance reasons.
|
*/
'update_references' => true,
/*
|--------------------------------------------------------------------------
| Always Augment to Query
|--------------------------------------------------------------------------
|
| By default, Statamic will augment relationship fields with max_items: 1
| to the result of a query, for example an Entry instance. Setting this
| to true will augment to the query builder instead of the result.
|
*/
'always_augment_to_query' => false,
/*
|--------------------------------------------------------------------------
| Row ID handle
|--------------------------------------------------------------------------
|
| Rows in Grid, Replicator, and Bard fields will be given a unique ID using
| the "id" field. You may need your own field named "id", in which case
| you may customize the handle of the field that Statamic will use.
|
*/
'row_id_handle' => 'id',
/*
|--------------------------------------------------------------------------
| Fake SQL Queries
|--------------------------------------------------------------------------
|
| Enable while using the flat-file Stache driver to show fake "SQL" query
| approximations in your database debugging tools — including Debugbar,
| Laravel Telescope, and Ray with the ray()->showQueries() helper.
|
*/
'fake_sql_queries' => config('app.debug'),
/*
|--------------------------------------------------------------------------
| Layout
|--------------------------------------------------------------------------
|
| Define the default layout that will be used by views.
|
*/
'layout' => env('STATAMIC_LAYOUT', 'layout'),
/*
|--------------------------------------------------------------------------
| View Config Allowlist
|--------------------------------------------------------------------------
|
| Config keys that are allowed to be accessed in Antlers templates. Use
| '@default' to include Statamic's default list. Add 'docs' so the docs
| version switcher can access config.docs.version and config.docs.versions.
|
*/
'view_config_allowlist' => ['@default', 'docs'],
];
================================================
FILE: config/statamic/templates.php
================================================
'antlers',
/*
|--------------------------------------------------------------------------
| Code Style
|--------------------------------------------------------------------------
|
| Here you may configure the code generator's output style.
|
*/
'style' => [
'line_ending' => 'auto',
'indent_type' => 'space',
'indent_size' => 4,
'final_newline' => false,
],
/*
|--------------------------------------------------------------------------
| Antlers Settings
|--------------------------------------------------------------------------
|
| Antlers specific template generation settings.
|
*/
'antlers' => [
'use_components' => false,
],
];
================================================
FILE: config/statamic/users.php
================================================
'file',
'repositories' => [
'file' => [
'driver' => 'file',
'paths' => [
'roles' => resource_path('users/roles.yaml'),
'groups' => resource_path('users/groups.yaml'),
],
],
'eloquent' => [
'driver' => 'eloquent',
],
],
/*
|--------------------------------------------------------------------------
| Avatars
|--------------------------------------------------------------------------
|
| User avatars are initials by default, with custom options for services
| like Gravatar.com.
|
| Supported: "initials", "gravatar", or a custom class name.
|
*/
'avatars' => 'initials',
/*
|--------------------------------------------------------------------------
| New User Roles
|--------------------------------------------------------------------------
|
| When registering new users through the user:register_form tag, these
| roles will automatically be applied to your newly created users.
|
*/
'new_user_roles' => [
//
],
/*
|--------------------------------------------------------------------------
| New User Groups
|--------------------------------------------------------------------------
|
| When registering new users through the user:register_form tag, these
| groups will automatically be applied to your newly created users.
|
*/
'new_user_groups' => [
//
],
/*
|--------------------------------------------------------------------------
| Registration form honeypot field
|--------------------------------------------------------------------------
|
| When registering new users through the user:register_form tag,
| specify the field to act as a honeypot for bots
|
*/
'registration_form_honeypot_field' => null,
/*
|--------------------------------------------------------------------------
| User Wizard Invitation Email
|--------------------------------------------------------------------------
|
| When creating new users through the wizard in the control panel,
| you may choose whether to be able to send an invitation email.
| Setting to true will give the user the option. But setting
| it to false will disable the invitation option entirely.
|
*/
'wizard_invitation' => true,
/*
|--------------------------------------------------------------------------
| Password Brokers
|--------------------------------------------------------------------------
|
| When resetting passwords, Statamic uses an appropriate password broker.
| Here you may define which broker should be used for each situation.
| You may want a longer expiry for user activations, for example.
|
*/
'passwords' => [
'resets' => 'users',
'activations' => 'activations',
],
/*
|--------------------------------------------------------------------------
| Database
|--------------------------------------------------------------------------
|
| Here you may configure the database connection and its table names.
|
*/
'database' => config('database.default'),
'tables' => [
'users' => 'users',
'role_user' => 'role_user',
'roles' => false,
'group_user' => 'group_user',
'groups' => false,
'webauthn' => 'webauthn',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| By default, Statamic will use the `web` authentication guard. However,
| if you want to run Statamic alongside the default Laravel auth
| guard, you can configure that for your cp and/or frontend.
|
*/
'guards' => [
'cp' => 'web',
'web' => 'web',
],
/*
|--------------------------------------------------------------------------
| Impersonation
|--------------------------------------------------------------------------
|
| Here you can configure if impersonation is available, and what URL to
| redirect to after impersonation begins.
|
*/
'impersonate' => [
'enabled' => env('STATAMIC_IMPERSONATE_ENABLED', true),
'redirect' => env('STATAMIC_IMPERSONATE_REDIRECT', null),
],
/*
|--------------------------------------------------------------------------
| Elevated Sessions
|--------------------------------------------------------------------------
|
| Users may be required to reauthorize before performing certain
| sensitive actions. This is called an elevated session. Here
| you may configure the duration of the session in minutes.
|
*/
'elevated_session_duration' => 15,
/*
|--------------------------------------------------------------------------
| Enforce Two-Factor Authentication
|--------------------------------------------------------------------------
|
| Specify which user roles should be required to enable two-factor
| authentication. Use "*" to enforce 2FA for all users, or "super_users"
| to enforce it for super users.
|
*/
'two_factor_enforced_roles' => [],
/*
|--------------------------------------------------------------------------
| Default Sorting
|--------------------------------------------------------------------------
|
| Here you may configure the default sort behavior for user listings.
|
*/
'sort_field' => 'email',
'sort_direction' => 'asc',
];
================================================
FILE: config/statamic/webauthn.php
================================================
true,
/*
|--------------------------------------------------------------------------
| Remember Me
|--------------------------------------------------------------------------
|
| Whether or not the "remember me" functionality should be used when
| authenticating using WebAuthn. When enabled, the user will remain
| logged in indefinitely, or until they manually log out.
|
*/
'remember_me' => true,
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| When using eloquent passkeys you can specify the model you want to use
|
*/
'model' => \Statamic\Auth\Eloquent\WebAuthnModel::class,
];
================================================
FILE: config/torchlight.php
================================================
env('TORCHLIGHT_CACHE_DRIVER'),
// Which theme you want to use. You can find all of the themes at
// https://torchlight.dev/docs/themes.
'theme' => env('TORCHLIGHT_THEME', 'synthwave-84'),
// Your API token from torchlight.dev.
'token' => env('TORCHLIGHT_TOKEN'),
// If you want to register the blade directives, set this to true.
'blade_components' => false,
// The Host of the API.
'host' => env('TORCHLIGHT_HOST', 'https://api.torchlight.dev'),
// We replace tabs in your code blocks with spaces in HTML. Set
// the number of spaces you'd like to use per tab. Set to
// `false` to leave literal tabs in the HTML.
'tab_width' => 4,
// If you pass a filename to the code component or in a markdown
// block, Torchlight will look for code snippets in the
// following directories.
'snippet_directories' => [
resource_path(),
],
// Global options to control blocks-level settings.
// https://torchlight.dev/docs/options
'options' => [
// Turn line numbers on or off globally.
'lineNumbers' => false,
'defaultLanguage' => 'antlers',
// Control the `style` attribute applied to line numbers.
// 'lineNumbersStyle' => '',
'fileStyle' => 'html',
// Turn on +/- diff indicators.
// 'diffIndicators' => true,
// If there are any diff indicators for a line, put them
// in place of the line number to save horizontal space.
// 'diffIndicatorsInPlaceOfLineNumbers' => true,
// When lines are collapsed, this is the text that will
// be shown to indicate that they can be expanded.
// 'summaryCollapsedIndicator' => '...',
],
];
================================================
FILE: content/assets/.gitkeep
================================================
================================================
FILE: content/assets/main.yaml
================================================
title: Main
disk: assets
================================================
FILE: content/collections/.gitkeep
================================================
================================================
FILE: content/collections/fieldtypes/array.md
================================================
---
title: Array
meta_title: Array Fieldtype
intro: Manage data in a `key:value` array format.
overview: |
The array fieldtype is used to manage `key: value` array data. It's similar to the [table](/fieldtypes/table) fieldtype but with a more strict data structure and compact user interface.
screenshot: fieldtypes/screenshots/v6/array.webp
screenshot_dark: fieldtypes/screenshots/v6/array-dark.webp
options:
-
name: keys
type: array
description: >
Define keys when using [keyed mode](#keyed-mode).
Default: `null`.
-
name: mode
type: string
description: "Determine which [mode](#modes) to use. Default: `dynamic`."
-
name: value_header
type: string
description: >
**Value** column heading displayed when using [dynamic mode](#dynamic-mode)
Default: `Value`.
-
name: key_header
type: string
description: >
**Key** column heading displayed when using [dynamic mode](#dynamic-mode)
Default: `Key`.
-
name: add_button
type: string
description: >
Add button text customization.
Default: `Add Row`.
-
name: expand
type: boolean
description: >
Save the field as an ordered list of `key` / `value` objects instead of a flat YAML mapping.
Enable when you need numeric keys, stable option order with database-backed content stores, or to avoid YAML limitations with certain key types.
Default: `false`.
id: 457f17eb-c0ee-4345-bf90-88322abc212d
---
## Overview
This fieldtype is used to manage `key: value` array data in the right situation. It's used for situations when there is data you would like to stay grouped together because there's only _one_ set and you don't want to use loops.
If you'd like to have _lists_ of this type of data, you might want to use a [grid](/fieldtypes/grid) or [replicator](/fieldtypes/replicator) field.
## Modes
The screenshot above depicts the three modes you can choose from. Two for when you know there is a fixed set of keys (keyed/single), and one for when you don't (dynamic).
### Keyed Mode
The first field contains pre-defined keys. This will give the user a stricter input. They can only enter the values for the specified keys, and they cannot be reordered.
```yaml
address:
type: array
keys:
street: Street
city: City
country: Country
```
The keys can be specified with or without labels. The snippet above (and what's shown in the screenshot) uses labels.
The following is an example of just keys. When using this syntax, the key and the label will be identical.
```
keys:
- street
- city
- country
```
### Single Mode
Exactly the same restrictions and setup as keyed mode, except the user can only manage an array one item at a time, using a select box to switch between keys.
### Dynamic Mode
The second field contains no pre-defined keys. This will allow the user to define them on the fly and re-arrange them.
```yaml
address:
type: array
```
Column headings can be set with `value_header` & `key_header`.
```
value_header: Type of Bacon
key_header: Why is it awesome?
```
### Expanded storage (`expand`) {#expanded-storage}
By default, array data is stored as a YAML mapping (`key: value`). Set `expand: true` to store it as an ordered list of objects instead:
```yaml
# expand: false (default)
sizes:
"42": Medium
"7": Small
# expand: true
sizes:
-
key: "42"
value: Medium
-
key: "7"
value: Small
```
Use expanded storage when keys need to be **numbers** (YAML mappings treat numeric keys oddly), when you rely on **explicit row order** (for example with the Eloquent Driver and MySQL, where key order on associative arrays is not preserved), or when you edit raw YAML and want unambiguous structure.
```yaml
inventory:
type: array
expand: true
keys:
sku: SKU
qty: Quantity
```
[Augmentation](/augmentation) still exposes the field as a normal key/value structure for templates and Antlers, so `{{ inventory:sku }}` and nested variable syntax behave the same whether `expand` is on or off.
## Data Structure
In the example above, the keyed mode and dynamic mode would save the exact same data (unless [expanded storage](#expanded-storage) is enabled—in that case the same logical keys are stored as a list of `key` / `value` objects).
```yaml
address:
street: 221B Baker Street
city: London
country: England
```
Single mode will only save data if it has been entered by the user.
```yaml
address:
England: '221 Baker Street, London'
```
## Templating
This fieldtype _is not_ [augmented](/augmentation).
::tabs
You can use basic array access, nested variables, or the [foreach tag](/tags/foreach) to loop through all of the keys. All three of the following methods are equivalent.
```antlers
// Array access
{{ address }}
{{ street }} {{ city }} {{ country }}
{{ /address }}
// Nested variables
{{ address:street }} {{ address:city }} {{ address:country }}
// Foreach tag:
{{ foreach:address }}
{{ value }}
{{ /foreach:address }}
```
::tab
You can use basic array access or the `@foreach` directive to loop through all of the keys.
```blade
// Nested variables
{{ $address['street'] }}
{{ $address['city'] }}
{{ $address['country'] }}
// Using foreach
@foreach ($address as $key => $value)
{{ $key }}: {{ $value }}
@endforeach
```
::
================================================
FILE: content/collections/fieldtypes/assets.md
================================================
---
title: Assets
meta_title: Assets Fieldtype
intro: Any time you want to list, display, or work with assets (external files with enhanced abilities), this is the way to do it. Upload, browse, reorder, delete, and even manage field data on individual assets.
description: Upload files and use the Asset Browser to pick from existing files in your Asset Containers.
screenshot: fieldtypes/screenshots/v6/assets-list.webp
screenshot_dark: fieldtypes/screenshots/v6/assets-list-dark.webp
options:
-
name: allow_uploads
type: bool
description: |
Enable to allow uploading new files into the container. Default: `true`.
-
name: container
type: string
description: |
The name of the desired [asset container](/assets#containers) to use for browsing, uploading, and managing assets. _Required when the site has more than one container._
-
name: folder
type: string
description: >
The folder (relative to the container) to begin browsing. Default: the root folder of the container.
-
name: dynamic
type: string
description:
Assets will be placed in a subfolder based on the value of this field. See [dynamic folders](#dynamic-folders). You may use `id`, `slug`, or `author`.
-
name: min_files
type: int
description: >
The minimum number of allowed files. Leave empty for no minimum.
-
name: max_files
type: int
description: >
The maximum number of allowed files. Set to `null` for unlimited. If set to `1`, will be saved as a string instead of an array. Default: `null`.
-
name: mode
type: string
description: >
Set to `list` to use the table layout mode, and `grid` to use the grid mode with larger thumbnails. Default: `grid`.
-
name: query_scopes
type: string
description: >
Allows you to specify a [query scope](/extending/query-scopes-and-filters#scopes) which should be applied when retrieving selectable assets. You should specify the query scope's handle, which is usually the name of the class in snake case. For example: `MyAwesomeScope` would be `my_awesome_scope`.
-
name: restrict
type: bool
description: >
If `true`, navigation within the asset browser will be disabled. Your users will be restricted to a specified container and folder. Default: `false`.
id: d0c65546-74f1-4a15-89d5-1562a95ee2c6
---
## Overview
The assets fieldtype is used to manage and relate files with your entries. From the fieldtype you can manage custom fields on the assets themselves (learn more about that in the [assets guide](/assets)), preview full size images or rich media files, and even set focal points for cropping.
Files are rearrangeable via drag-and-drop.
## UI Modes
The list mode is shown in the previous screenshot, while the grid mode is shown below. There are no functional differences, only visual ones. List mode is more compact – useful if you're not primarily managing images.
List mode reveals a fanny pack in all its glory. And if you’re British—go on, have a little chuckle.
## Data Structure
Data is stored as an array of image paths _relative to the asset container_. Each asset's full URL is generated dynamically on the frontend based on the image path and its container. This allows containers to be a bit more portable by avoiding fully hardcoded file paths.
If `max_files` is set to `1`, a string will be saved instead of an array.
``` yaml
# Default YAML
gallery_images:
- fresh-prince.jpg
- dj-jazzy-jeff.jpg
- uncle-phil.jpg
# With max_files: 1
hero_image: surf-boards.jpg
```
## Templating
The Asset fieldtype uses [augmentation](/augmentation) to automatically relate the files with their Asset records, pull in custom and meta data, and resolve all image paths based on the container.
::tabs
By using a tag pair syntax, you'll be able to output variables for each asset:
```antlers
{{ gallery_images }}
{{ /gallery_images }}
{{ hero_image }}
{{ /hero_image }}
```
::tab
You can use the `@foreach` directive to loop over each asset and output its variables:
```blade
@foreach ($gallery_images as $asset)
@endforeach
{{-- Assuming $hero_image is max_files: 1 --}}
```
::
```html
```
The same tag pair syntax can be used regardless of your `max_files` setting.
::tabs
If you have `max_files: 1`, you can also use a single tag syntax to directly use a variable inside the asset. Without a second tag part, the URL will be used.
```antlers
{{ hero_image }}
{{ hero_image:url }}
{{ hero_image:alt }}
```
::tab
If you have `max_files: 1`, you can use property access to output variables within the asset. When output as a string, the URL will be used.
```blade
{{ $hero_image }}
{{ $hero_image->url }}
{{ $hero_image->alt }}
```
::
```html
/assets/surf-boards.jpg
/assets/surf-boards.jpg
3 colorful surf boards
```
### Variables
Inside an asset variable's tag pair you'll have access to the following variables.
| Variable | Description |
|----------|-------------|
| `url` | Web-friendly URL to the file. |
| `path` | Path to the file relative to asset container |
| `permalink` | Absolute URL to the file including your site URL. |
| `basename` | Name of the file with file extension |
| `blueprint` | Which blueprint is managing the asset container |
| `container` | Which asset container the file is in |
| `edit_url` | URL to edit asset in the Control Panel |
| `extension` | File extension |
| `filename` | Name of the file without file extension |
| `folder` | Which folder the file is in |
| `is_audio` | `true` when file is one of `aac`, `flac`, `m4a`, `mp3`, `ogg`, or `wav`. |
| `is_image` | `true` when file is one of `jpg`, `jpeg`, `png`, `gif`, or `webp`. |
| `is_svg` | `true` when file is an `svg`. |
| `is_video` | `true` when file is one of `h264`, `mp4`, `m4v`, `ogv`, or `webm`. |
| `last_modified` | Formatted date string of the last modified time |
| `last_modified_instance` | [Carbon][carbon] instance of the last modified time |
| `last_modified_timestamp` | Unix timestamp of the last modified time |
| `size` | Pre-formatted file size (`3.48 MB`) |
| `size_b` | File size in bytes |
| `size_kb` | File size in kilobytes |
| `size_mb` | File size in megabytes |
| `size_gb` | File size in gigabytes |
### Image Assets
| Variable | Description |
|----------|-------------|
| `height` | height of an image, in pixels |
| `width` | width of an image, in pixels |
| `focus_css` | CSS `background-image` property for a focal point
| `orientation` | Is one of `portrait`, `landscape`, `square`, or `null`. |
| `ratio` | An image's ratio (`1.77`) |
:::tip
You can use [Glide](/tags/glide) to crop, flip, sharpen, pixelate, and perform other sweet image manipulations.
:::
### Asset Field Data
::tabs
All custom data set on the assets will also be available inside the asset tag loop.
```antlers
{{ gallery_images }}
{{ caption }}
{{ /gallery_images }}
```
::tab
All custom data set on the assets will also be available on the asset instance.
```blade
@foreach ($gallery_images as $image)
@if ($caption = $image->caption)
{{ $caption }}
@endif
@endforeach
```
::
## Dynamic Folders
In addition to selecting which container and folder assets will be uploaded into, you may configure the field to have a dedicated subfolder based on an entry's value.
For example, you may want to place all the images for a blog post in its own directory.
```yaml
type: assets
container: images
folder: blog
dynamic: slug
```
This would result in `image.jpg` being uploaded to `path/to/images/blog/my-entry-slug/image.jpg`.
You may target the entry's `id`, `slug`, or `author` values.
:::warning
The values are *not* kept in sync. For example, if you change the entry's slug, the asset folder will not be renamed. You may rename the folder manually via a control on the field, or within the asset browser.
:::
[carbon]: https://carbon.nesbot.com/docs/
================================================
FILE: content/collections/fieldtypes/bard.md
================================================
---
title: Bard
description: "Rich article writing and block-based layouts made easy."
intro: |
Bard is more than just a content editor, and more flexible than a block-based editor. **It is designed to provide a delightful and powerful writing experience** with unparalleled flexibility on your front-end.
screenshot: fieldtypes/screenshots/v6/bard-with-sets.webp
screenshot_dark: fieldtypes/screenshots/v6/bard-with-sets-dark.webp
options:
-
name: allow_source
type: boolean
description: |
Controls whether the "show source code" button is available to your editors. Default: `true`.
-
name: sets
type: array
description: An array containing sets of fields. If you don't provide any sets, Bard will act like a basic text/WYSIWYG editor and you won't see the "Add Set" button.
-
name: buttons
type: array
description: |
An array of buttons you want available in the toolbar.
You can choose from `h1`, `h2`, `h3`, `h4`, `h5`, `h6`, `bold`, `italic`, `small`, `underline`, `strikethrough`, `unorderedlist`, `orderedlist`, `removeformat`, `quote`, `anchor`, `image`, `table`, `code` (inline), `codeblock`, and `horizontalrule`.
These are the defaults:
 {.mt-4}
You can override the default buttons using the `Bard::setDefaultButtons()` method:
```php
\Statamic\Fieldtypes\Bard::setDefaultButtons(['h2', 'h3', 'bold', 'italic']);
```
When you have the `image` button toggled, make sure to define an Asset Container in the Bard field's settings, otherwise the button won't show.
-
name: target_blank
type: boolean
description: |
Automatically add `target="_blank"` on links by default. You'll be able to override this per-link. Default: `false`.
-
name: link_noopener
type: boolean
description: |
Set `rel="noopener"` on all created links. Default: `false`.
-
name: link_noreferrer
type: boolean
description: |
Set `rel="noreferrer"` on all created links. Default: `false`.
-
name: fullscreen
type: boolean
description: |
Enable the option to toggle into fullscreen mode. Default: `true`.
-
name: collapse
type: boolean
description: >
Expand (`true`) or collapse (`false`) all sets by default. Default: `false`.
-
name: container
type: string
description: >
An asset container ID. When specified, the fieldtype will allow the user to add a link to an asset from the specified container.
-
name: inline
type: boolean
description: |
Switch the field to inline mode. Block elements such as sets, headings and images are not supported in inline mode and should not be enabled.
-
name: inline_hard_breaks
type: boolean
description: |
Enable support for hard breaks in inline mode. Only works when `inline` is set to `true`. Default: `false`.
-
name: toolbar_mode
type: string
description: >
Choose which style of toolbar you prefer, `fixed` or `floating`. Default: `fixed`.
-
name: reading_time
type: boolean
description: >
Show estimated reading time at the bottom of the field. Default: `false`.
-
name: word_count
type: boolean
description: >
Show the word count at the bottom of the field. Default: `false`.
-
name: save_html
type: boolean
description: >
Save as HTML instead of structured data. This simplifies templates so you don't need to loop through the structured nodes. Only works while no sets are defined. Default: `false`.
-
name: always_show_set_button
type: boolean
description: >
Always show the "Add Set" button. Default: `false`.
-
name: remove_empty_nodes
type: string
description: >
Choose how to deal with empty nodes. Options: `false`, `true`, `trim`. Default: `false`.
id: f4bf58d3-cbce-4957-b883-d92fd4791e89
---
## Overview
Bard is our recommended fieldtype for creating long form content from the control panel. It's highly configurable, intuitive, user-friendly, and writes impeccable HTML (thanks to [ProseMirror][prosemirror]).
Bard also has the ability to manage "sets" of fields inline with your text. These sets can contain any number of other fields of any [fieldtype](/fieldtypes), and can be collapsed and neatly rearranged in your content.
## Working With Sets {#sets}
You can use any fieldtypes inside your Bard sets. Make sure to compare the experience with the other meta-fields: [Grid](/fieldtypes/grid) and [Replicator](/fieldtypes/replicator). You can even use Grids and Replicators inside your Bard sets. Just remember that because you can doesn't mean you should. Your UI experience can vary greatly.
### Set Previews
New to Statamic v6, you can add an image preview of your set, _as well as_ an icon. Previews make it easy to identify sets by showing a screenshot of what the rendered set might look like on the front-end. Clients can now say “ah, that one” without pretending to know the names you carefully gave them.
#### Configuring Set Previews
To add a set preview, click the little "pencil" icon next to the set name.
Let's give the set a preview.
Once you're in the set editor, you can add a preview image and icon. Here we're showing a lovely screenshot of what the newsletter signup form might look like on the front-end. We can even add some instructions to explain how the set is used.
Behold a Preview Image, for the love of all clients.
#### Set Previews in Action
Once you've set a preview image, users adding a bard set can hover over the set to preview what it might look like on the frontend.
You can view previews in two different UI modes: in a list of set names, or in a grid of sets with their preview images.
A preview in a list of sets.A preview in a grid of sets. Previews fall back to the set icon if no preview image is set.
### Custom Set Icons
You can change the icons available in the set picker by configuring an icon set in a service provider.
For example, you can drop this into your `AppServiceProvider`'s `boot` method:
```php
use Statamic\Fieldtypes\Sets;
public function boot()
{
Sets::useIcons('heroicons', resource_path('svg/heroicons'));
}
```
## Data Structure
Bard stores your data as a [ProseMirror document](https://prosemirror.net/docs/ref/#model.Document_Structure). You should never need to interact with this data directly, thanks to [augmentation](/augmentation).
## Templating
### Without Sets
If you are using Bard just as a rich text editor and have no need for sets you would use a single tag to render the content.
::tabs
```antlers
{{ bard_field }}
```
::tab
```blade
{!! $bard_field !!}
```
::
### With Sets
When working with sets, you should use the tag pair syntax and `if/else` conditions on the `type` variable to style each set accordingly. **Note**: any content that is entered _not_ in a set (i.e. your normal rich-text content) needs to be rendered using the "text" type. See the first condition using "text."
::tabs
```antlers
{{ bard_field }}
{{ if type == "text" }}
@endif
@endforeach
```
::
An alternative approach (for those who like DRY or small templates) is to create multiple "set" partials and pass the data to them dynamically, moving the markup into corresponding partials bearing the set's name.
::tabs
::tab antlers
```antlers
{{ bard_field }}
{{ partial src="sets/{type}" }}
{{ /bard_field }}
```
``` files theme:serendipity-light
resources/views/partials/sets/
gallery.antlers.html
hero_image.antlers.html
poll.antlers.html
text.antlers.html
video.antlers.html
```
::tab blade
:::tip
By using `[...$set]`, you can access the set variables within the set's Blade file without having to reference `$set` for each variable.
For example, `{!! $set->text !!}` becomes `{!! $text !!}`.
:::
```blade
@foreach ($bard_field_with_sets as $set)
@include('fieldtypes.bard.sets.'.$set->type, [...$set])
@endforeach
```
``` files theme:serendipity-light
resources/views/partials/sets/
gallery.blade.php
hero_image.blade.php
poll.blade.php
text.blade.php
video.blade.php
```
::
## Extending Bard
Bard uses [TipTap](https://tiptap.dev/) (which in turn is built on top of [ProseMirror][prosemirror]) as the foundation for our quintessential block-based editor.
[prosemirror]: https://prosemirror.net/
### Required Reading
Before you attempt to create any Bard extensions, it is wise to learn how to write a Tiptap extension first. Otherwise you'd be trying to learn how to ride a motorcycle before you can even ride a bike. Or a unicycle before you can juggle. To have a better understanding of how to write a Tiptap extension, you'd in turn benefit greatly on reading about how ProseMirror works.
:::tip
Writing custom extensions for Bard is pretty complicated, but can be rewarding and provide powerful results.
:::
In short, here's a quick-start of the things you should probably start with:
- [The ProseMirror guide](https://prosemirror.net/docs/guide/) — Yes, it's really long, but you should at least pretend to read it
- Checking out the [The Tiptap documentation](https://tiptap.dev/docs/editor/getting-started/overview) and [code samples for the core Tiptap extensions](https://github.com/ueberdosis/tiptap/tree/develop/packages), so you can understand how Tiptap relates to ProseMirror
- If you don't know [how to extend the control panel](/control-panel/css-javascript) yet, go ahead and read up on that first. The code snippets later will be part of your extension to the control panel. Alternatively, you may also [extend the control panel through the creation of an addon](/addons/building-an-addon).
- Come back here again and keep on going.
### Adding New Extensions
You may add your own Tiptap extensions to Bard using the `addExtension` method. The callback may return a single extension, or an array of them.
``` js
const { Node, Mark, Extension } = Statamic.$bard.tiptap.core;
Statamic.$bard.addExtension(() => Node.create({...}));
```
``` js
Statamic.$bard.addExtension(() => {
return [
Node.create({...}),
Mark.create({...}),
Extension.create({...}),
]
});
```
Check out [Tiptap's custom extension documentation](https://tiptap.dev/docs/editor/extensions/custom-extensions) and [code samples for the core Tiptap extensions](https://github.com/ueberdosis/tiptap/tree/develop/packages) to find out how to write an extension.
If you're providing a new mark or node and intend to use this Bard field on the front-end, you will also need to create a Mark or Node class to be used by the PHP [renderer](#tiptap-php-rendering).
:::tip
If you need any other Tiptap helpers or utilities you can use our [Tiptap API](#tiptap-api).
:::
### Replacing Existing Extensions
If you'd like to replace a [native extension](https://github.com/ueberdosis/tiptap/tree/develop/packages) (e.g. headings or paragraphs) you can use the `replaceExtension` method. It takes the `name` of the extension, and a callback that returns a single extension instance.
```js
const { Node } = Statamic.$bard.tiptap.core;
Statamic.$bard.replaceExtension('heading', ({ extension, bard }) => {
return Node.create({
name: 'heading',
...
});
});
```
The callback will provide you with the existing extension instance, so if you are doing simple tweaks to an extension (e.g. customizing an input rule) you can simply extend the existing instance. Then you don't need to author an entire extension:
```js
const { nodeInputRule } = Statamic.$bard.tiptap.core;
Statamic.$bard.replaceExtension('heading', ({ extension, bard }) => {
return extension.extend({
addInputRules() {
return [
nodeInputRule({...}),
];
},
});
});
```
You can also reconfigure extensions (e.g. to add Tailwind classes to headings or disable specific "smart typography" rules):
```js
Statamic.$bard.replaceExtension('heading', ({ extension, bard }) => {
return extension.configure({
HTMLAttributes: {
class: 'font-bold',
},
});
});
```
```js
Statamic.$bard.replaceExtension('typography', ({ extension, bard }) => {
return extension.configure({
oneHalf: false,
oneQuarter: false,
threeQuarters: false,
});
});
```
### Buttons
To add a button to the toolbar, provide a callback to the `buttons` method.
The callback will receive two arguments:
- `buttons` - an array of the existing buttons in the toolbar (more about that in a moment)
- `button` - a function that wraps your button objects
The callback may return a `button` object, or an array of them.
``` js
Statamic.$bard.buttons((buttons, button) => {
return button({
name: 'custom_bold',
text: __('Custom Bold'), // Tooltip text
svg: 'bold', // Name of an SVG icon
html: '', // Custom icon HTML
args: { class: 'font-bold' }, // The command arguments
command: (editor, args) => editor.chain().focus().setCustomBold(args).run(), // The command to run
activeName: 'customBold', // The active node/mark type that will activate this button (falls back to name)
active: (editor, args) => editor.isActive('bold'), // Active check callback (overrides activeName)
visibleWhenActive: 'example', // The active node/mark type that will show this button (always visible if not set)
visible: (editor, args) => editor.isActive('example'), // Visible check callback (overrides visibleWhenActive)
});
});
```
``` js
Statamic.$bard.buttons((buttons, button) => [
button({...}),
button({...}),
]);
```
Returning values to the `buttons` method will push them onto the end. If you need more control, you can manipulate the supplied `buttons` argument, and then return nothing. For example, we'll add a button after wherever the existing bold button happens to be:
``` js
Statamic.$bard.buttons((buttons, button) => {
const indexOfBold = _.findIndex(buttons, { name: 'bold' });
buttons.splice(indexOfBold + 1, 0, button({...}));
});
```
:::tip
Using the `button()` method will make the button only appear if the Bard field has been configured to show your button.
If you'd like your button to appear on all Bard fields, regardless of whether it's been configured to use that button, you can just return an object. Don't wrap with `button()`.
:::
### Tiptap API
In your extensions, you may need to use functions from the `tiptap` library. Rather than importing the library yourself and bloating your JS files, you may use methods through our API.
``` js
Statamic.$bard.tiptap.core; // `tiptap` (core, commands, utilities and helpers)
Statamic.$bard.tiptap.pm.state; // `prosemirror-state`
Statamic.$bard.tiptap.pm.model; // `prosemirror-model`
Statamic.$bard.tiptap.pm.view; // `prosemirror-view`
```
You could shorten things up by using destructuring. For example:
``` js
const { InputRule, insertText, getAttributes } = Statamic.$bard.tiptap.core;
new InputRule(...);
insertText(...);
getAttributes(...);
```
### Tiptap PHP Rendering
If you have created an extension on the JS side to be used inside the Bard fieldtype, you will need to be able to render it on the PHP side (in your views).
The Bard `Augmentor` class is responsible for converting the ProseMirror structure to HTML.
You can use the `addExtension` or `replaceExtension` methods to bind an extension class into the renderer. Your AppServiceProvider's `boot` method is a good place to do this.
``` php
use Statamic\Fieldtypes\Bard\Augmentor;
public function boot()
{
// Pass an object
Augmentor::addExtension('myExtension', new MyExtension);
// or a closure. You will be passed the bard fieldtype and an array of options as arguments.
Augmentor::addExtension('myExtension', function ($bard, $options) {
return new MyExtension(['foo' => $bard->config('should_foo')];
});
// Same for replacing extensions.
Augmentor::replaceExtension('paragraph', new MyCustomParagraph);
// Closures too. There will be an additional argument at the front which is the existing extension.
Augmentor::replaceExtension('paragraph', function ($existing, $bard, $options) {
return new CustomParagraph;
});
}
```
Check out [code samples for the core Tiptap extensions](https://github.com/ueberdosis/tiptap-php/tree/main/src) to find out how to write PHP extensions.
================================================
FILE: content/collections/fieldtypes/button_group.md
================================================
---
title: 'Button Group'
description: 'Buttons you click. You can only choose one.'
intro: |
Buttons. Create some options and let your users select one and only one. May they choose wisely.
screenshot: fieldtypes/screenshots/v6/button-group.webp
screenshot_dark: fieldtypes/screenshots/v6/button-group-dark.webp
options:
-
name: clearable
type: boolean
description: |
Allow deselecting all options, making `null` a possible value. Default: `false`.
-
name: options
type: array
description: 'Sets of key/value pairs define the values and labels of the buttons.'
id: 26751221-fdc8-47c6-97f0-bf4997319482
---
## Overview
The button group fieldtype is a multiple choice input where you only get one choice. It saves the chosen option from a preset list.
## Configuring
Use the `options` setting to define a list of values and labels.
``` yaml
seat_choice:
type: button_group
instructions: Choose your airline seat. Choose wisely.
options:
left: Left
middle: Middle
right: Right
```
You may omit the labels and just specify keys. If you use this syntax, the value and label will be identical.
``` yaml
options:
- Left
- Middle
- Right
```
### Options in blueprint YAML
Like the [select](/fieldtypes/select) fieldtype, `options` in the blueprint are saved in **expanded** form (ordered `key` / `value` rows) so option order is preserved in all storage backends. Hand-written blueprints should follow that structure if you are not using the visual editor.
```yaml
options:
- key: left
value: Left
- key: middle
value: Middle
```
## Data Structure
The chosen option is stored as a string. If you only specified values for the `options` array, then the label will be saved.
``` yaml
seat_choice: middle
```
## Templating
It's a string, so you can just use that value.
::tabs
::tab antlers
```
I love sitting in the {{ seat_choice }} seat. A lot.
```
::tab blade
```blade
I love sitting in the {{ $seat_choice }} seat. A lot.
```
::
```html
I love sitting in the middle seat. A lot.
```
================================================
FILE: content/collections/fieldtypes/checkboxes.md
================================================
---
title: Checkboxes
description: Boxes you check. You can check 'em all.
intro: >
Checkboxes! Make some checkboxes, click the checkboxes, and store a record of which boxes of which ones you clicked. They're boxes you check.
screenshot: fieldtypes/screenshots/v6/checkboxes.webp
screenshot_dark: fieldtypes/screenshots/v6/checkboxes-dark.webp
options:
-
name: inline
type: bool
description: >
Show the checkboxes next to each other in a row instead of stacked vertically. Default: `false`
-
name: options
type: array
description: >
Sets of key/value pairs define the values and labels of the checkbox options.
id: f922cb9b-6fc9-4249-adf4-59aa46285c13
---
## Overview
The checkboxes fieldtype is a multiple choice input. It saves one or more options chosen from a preset list. In other words, they're boxes you check.
## Configuring
Use the `options` setting to define a list of values and labels.
``` yaml
favorites:
type: checkboxes
instructions: Choose up to 3 favorite foods.
options:
donuts: Donuts
icecream: Ice Cream
brownies: Brownies
```
You may omit the labels and just specify keys. If you use this syntax, the value and label will be identical.
``` yaml
options:
- Donuts
- Ice Cream
- Brownies
```
### Options in blueprint YAML
See [Select · Options in blueprint YAML](/fieldtypes/select#options-in-blueprint-yaml)—checkbox options in the blueprint use the same expanded `key` / `value` rows so order is preserved everywhere.
## Data Structure
The values are stored as a YAML array. If you only specified values for the `options` array, then the labels will be saved.
``` yaml
favorites:
- donuts
- icecream
```
## Templating
You can loop through the checked items and access the value and label of each item inside the loop.
::tabs
::tab antlers
```
{{ favorites }}
{{ value }}
{{ /favorites }}
```
::tab blade
```blade
@foreach($favorites as $favorite)
{{-- You can also access $favorite['key'] and $favorite['label'] --}}
{{ $favorite['value'] }}
@endforeach
```
::
```html
donuts
icecream
```
::tabs
::tab antlers
To conditionally check if a value has been selected, you can combine the [pluck](/modifiers/pluck) and [contains](/modifiers/contains) modifiers:
```antlers
{{ if favorites | pluck('value') | contains('donuts') }}
Contains donuts!
{{ /if }}
```
::tab blade
To conditionally check if a value has been selected, you can combine the pluck and contains collection methods:
```blade
@if (collect($favorites)->pluck('value')->contains('donuts'))
Contains donuts!
@endif
```
::
### Variables
Inside an asset variable's tag pair you'll have access to the following variables.
| Variable | Description |
|----------|-------------|
| `key` | The zero-index count of the current item |
| `value` | The stored value of the checkbox |
| `label` | The label of the checkbox item from the field config |
================================================
FILE: content/collections/fieldtypes/code.md
================================================
---
title: Code
description: 'Write code and see it highlight. But will you choose spaces or tabs?'
intro: What are you doing writing code in a browser?! Just kidding, it's fine. We made it easy, flexible, and pretty too. We use this fieldtype a lot.
screenshot: fieldtypes/screenshots/v6/code.webp
screenshot_dark: fieldtypes/screenshots/v6/code-dark.webp
options:
-
name: theme
type: string
description: |
Choose between `light` and `material` (dark) themes. Default: `light`.
-
name: mode
type: string
description: |
Set a default language for syntax highlighting. Your choices include:
- `clike`
- `css`
- `diff`
- `go`
- `haml`
- `handlebars`
- `htmlmixed`
- `less`
- `markdown`
- `gfm`
- `nginx`
- `text/x-java`
- `javascript`
- `jsx`
- `text/x-objectivec`
- `php`
- `python`
- `ruby`
- `scss`
- `shell`
- `sql`
- `twig`
- `vue`
- `xml`
- `yaml-frontmatter`
-
name: mode_selectable
type: boolean
description: |
Whether the `mode` can be selected by the user in the publish form. Enabling this will change the GraphQL
type from a string to a Code type.
-
name: indent_type
type: string
description: |
Choose between `tabs` and `spaces`. Choose wisely. Default: `tabs`.
-
name: indent_size
type: integer
description: |
Set your preferred indentation size (in spaces). Default: `4`.
-
name: line_numbers
type: boolean
description: |
Show line numbers.
-
name: line_wrapping
type: boolean
description: |
Enable to wrap long lines of code instead of showing a horizontal scroll. Default: `true`.
-
name: key_map
type: string
description: |
Pick your preferred set of keyboard shortcuts. Choose between `default`, `sublime`, and `vim`. We'll let you guess which one is default.
-
name: rulers
type: array
description: |
You can set the columns and the line style (choose between `dashed` or `solid`) of any rulers you wish to use.
id: 3ca28569-5b86-49a1-b620-ea3364561cde
---
## Overview
If your content involves code snippets, this is the fieldtype for you. It's a [CodeMirror](https://codemirror.net) field with 25 of the most common languages ready for highlighting, handles tabs and spaces, has a dark mode, and best of all — for you super nerds out there — a vim key binding.
## Data Structure
The code fieldtype stores a string. Do whatever you'd like with it.
``` yaml
code_snippet: |
{{ code_snippet }}
```
::tab blade
```blade
{!! $code_snippet !!}
```
::
You're also able to use it as an array if you want to output the mode.
::tabs
::tab antlers
```
{{ code_snippet }}
{{ code }}
{{ /code_snippet }}
```
::tab blade
```blade
{!! $code_snippet['code'] !!}
```
::
### Variables
Inside an code fieldtype's tag pair you'll have access to the following variables.
| Variable | Description |
|----------|-------------|
| `code` | The contents of the field. |
| `mode` | The selected language mode. |
================================================
FILE: content/collections/fieldtypes/collections.md
================================================
---
title: Collections
extends: 9dd58c40-6e33-49c8-83fa-61a69f6371be
description: Choose from one or more collections.
overview: Allows you to choose one or more collections.
options:
-
name: max_items
type: integer
description: >
The maximum number of items that may be selected. Setting this to `1` will change the UI to a dropdown.
screenshot: /fieldtypes/screenshots/collections.png
id: 44c3da60-ef47-408e-afc4-a33026c86f5d
---
## Usage
This fieldtype is used to view and select from a list of Collections.
```yaml
fields:
my_collections_field:
type: collections
```
## Data Structure
The Collections fieldtype is a [Relationship fieldtype](/relationships#fieldtypes), and will save the collections as their handles (the folder name).
```yaml
listings:
- blog
- things
```
## Templating
You're more than likely using this field as a way to dynamically display a collection.
::tabs
::tab antlers
Since the collection tag accepts a pipe-delimited list of collection names, you can join them together like this:
```antlers
{{ collection from="{listings|piped}" }}
{{ title }}
{{ /collection }}
```
::tab blade
You can pass the values from the collections fieldtype to the collection tag like so:
```blade
{{ $title }}
```
::
```html
A blog entry
A thing entry
etc
```
================================================
FILE: content/collections/fieldtypes/color.md
================================================
---
title: Color
description: 'Manage colors by hex code with swatches and text inputs.'
intro: 'A simple color picker with support for pre-defined swatches as well as entering a color by hex code.'
screenshot: fieldtypes/screenshots/v6/color.webp
screenshot_dark: fieldtypes/screenshots/v6/color-dark.webp
options:
-
name: swatches
type: array
description: |
Pre-define colors that can be selected from a list. Supports all color mode formats.
-
name: allow_any
type: boolean
description: |
Allow entering any color value via picker or hex code.
id: 09b4af2d-265a-49ee-ac74-3e27041c180b
---
## Overview
If you want work with colors, this is the way to do it. You could combine it with [Bard](/fieldtypes/bard) or [Replicator](/fieldtypes/replicator) to create page "page builders", use it to choose background colors for headers or hero blocks, or even image overlays with `mix-blend-mode: multiply`. Go get creative!
## Data Structure
The color fieldtype stores the color values as a hex string.
``` yaml
header_color: "#FF269E"
```
## Templating
The color is output as a simple string. Most often you'll use this in an inline `style` tag to style elements of your front-end site.
::tabs
::tab antlers
```antlers
Bay Side High's Sweetheart Dance
This Friday Night!
```
::tab blade
```blade
Bay Side High's Sweetheart Dance
This Friday Night!
```
::
================================================
FILE: content/collections/fieldtypes/date.md
================================================
---
title: Date
description: Helps you pick a date, but not get one.
intro: >
Work with dates, times, and ranges with a variety of user interface options that make you really enjoy basically just picking numbers from a table.
screenshot: fieldtypes/screenshots/v6/date.webp
screenshot_dark: fieldtypes/screenshots/v6/date-dark.webp
options:
-
name: columns
type: integer
description: |
Show multiple months at one time, in columns and rows. Default: `1`.
-
name: earliest_date
type: string
description: |
Set the earliest selectable date in `YYYY-MM-DD` format. Default: `1900-01-01`.
-
name: format
type: string
description: |
How the date should be stored, using the [PHP date format](https://www.php.net/manual/en/datetime.format.php). We recommend choosing a format which stores date & time.
-
name: full_width
type: boolean
description: |
Enable to stretch the calendar out like Stretch Armstrong, using the maximum amount of available horizontal space. Default: `false`.
-
name: inline
type: boolean
description: |
Always show the calendar instead of the text input and dropdown UI. Default: `false`.
-
name: mode
type: string
description: |
Choose between `single` or `range`. Range mode disables the time picker. Default: `single`.
-
name: rows
type: integer
description: |
Show multiple months at one time, in columns and rows. Default: `1`.
-
name: time_enabled
type: boolean
description: |
Enable/disable the timepicker. Default: `false`.
Now you can pick a time, too!
-
name: time_required
type: boolean
description: |
Makes the time field visible and non-dismissible. Default: `false`.
-
name: timezone
type: string
description: |
The timezone dates will be displayed and entered in within the Control Panel. Accepts any [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g. `America/New_York`). Defaults to the site-wide [`default_timezone`](#control-panel-timezone) configured in `config/statamic/cp.php`, which itself defaults to `auto` (the browser's local timezone).
id: 7dfba904-8a74-40e1-b507-51cd2b5f6123
---
## Overview
Date fields have highly configurable user interfaces. They can be as simple as a single date and/or time, or as fancy as a multi-month calendar with multi-day range picking. Be sure to experiment with the various config [options](#options) to create the best experience for your content authors.
## Data Structure
Single dates are stored as a date/timestring. Ranges are stored as an array with a `start` and `end` key.
``` yaml
date: 1983-10-01 12:00:00
date_range:
start: 2019-11-18 00:00
end: 2019-11-22 00:00
```
Dates are stored in your application's timezone.
The time will be when `time_enabled` is `true`, or depending on the timezone of the user who selected the date. e.g. On date fields where there is no time configured, it will assume midnight for the person who selected it.
## Templating
Date fields are [augmented](/augmentation) to return a [Carbon instance][carbon]. When used as a string they will return a pre-formatting output that uses your `config.date` format setting. By default that'll look like `January 1, 2020`.
### Date Ranges
Ranges have nested `start` and `end` variables, so you can access them like this:
::tabs
::tab antlers
```antlers
// Nested variable
Event: {{ date:start }} through {{ date:end }}
// Tag pair
{{ date }}
Event: {{ start }} through {{ end }}
{{ /date }}
```
::tab blade
```blade
Event: {{ $date_range['start'] }} through {{ $date_range['end'] }}
```
::
Ranges are much simpler than two date fields.
### Formatting Dates
You can format the output of your date fields with the [format modifier](/modifiers/format) and PHP's [date formatting options](https://www.php.net/manual/en/function.date.php).
::tabs
::tab antlers
```antlers
{{ date format="Y" }} // 2019
{{ date format="Y-m-d" }} // 2019-10-10
{{ date format="l, F jS" }} // Sunday, January 21st
```
::tab blade
When using Blade, you may also call the `->format` method on Carbon instances.
```blade
{{-- Using Modifiers --}}
{{ Statamic::modify($date)->format('Y') }} // 2019
{{ Statamic::modify($date)->format('Y-m-d') }} // 2019-10-10
{{ Statamic::modify($date)->format('l, F jS') }} // Sunday, January 21st
{{-- Using Carbon methods --}}
{{ $date->format('Y') }} // 2019
{{ $date->format('Y-m-d') }} // 2019-10-10
{{ $date->format('l, F jS') }} // Sunday, January 21st
```
::
### Formatting localized Dates
You can format localized dates with the [iso modifier](/modifiers/iso_format) and [ISO formatting options](https://carbon.nesbot.com/docs/#api-localization). This use Carbon's inner translations rather than language packages you need to install on every machine where you deploy your application.
::tabs
::tab antlers
```antlers
{{ date iso_format="YYYY" }} // 2019
{{ date iso_format="YYYY-MM-DD" }} // 2019-10-10
{{ date iso_format="dddd, MMMM Do" }} // Sunday, January 21st
```
::tab blade
When using Blade, you may also call the `->isoFormat` method on Carbon instances.
```blade
{{-- Using Modifiers --}}
{{ Statamic::modify($date)->isoFormat('YYYY') }} // 2019
{{ Statamic::modify($date)->isoFormat('YYYY-MM-DD') }} // 2019-10-10
{{ Statamic::modify($date)->isoFormat('dddd, MMMM Do') }} // Sunday, January 21st
{{-- Using Carbon methods --}}
{{ $date->isoFormat('YYYY') }} // 2019
{{ $date->isoFormat('YYYY-MM-DD') }} // 2019-10-10
{{ $date->isoFormat('dddd, MMMM Do') }} // Sunday, January 21st
```
::
## Timezones
Dates are stored in your application timezone, then converted before being displayed to users.
For more information on how Statamic handles timezones, please review our [Timezones](/tips/timezones) guide.
### Control Panel Timezone
By default, dates in the Control Panel are displayed and entered in the browser's local timezone. This means a user in New York and a user in London editing the same entry would each see the date in their own timezone.
If you'd prefer all users to see and enter dates in a specific timezone, you can configure it site-wide in `config/statamic/cp.php`:
```php
'default_timezone' => env('STATAMIC_CP_DEFAULT_TIMEZONE', 'auto'),
```
Set this to any [IANA timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) (e.g. `America/New_York`) to pin all date fields to that timezone. The default value of `auto` uses each user's browser timezone.
You can also override this on a per-field basis with the [`timezone`](#options) field config option.
[carbon]: https://carbon.nesbot.com/docs/
================================================
FILE: content/collections/fieldtypes/dictionary.md
================================================
---
title: Dictionary
description: Choose from options provided by dictionaries.
intro: Give your users a list of options to choose from. Similar to the Select field, but allows you to read options from YAML or JSON files, or even hit external APIs.
screenshot: fieldtypes/screenshots/v6/dictionary.webp
screenshot_dark: fieldtypes/screenshots/v6/dictionary-dark.webp
options:
-
name: dictionary
type: array
description: |
Configure the dictionary to be used. You may also define any config values which should be passed along to the dictionary. The `dictionary` option accepts both string & array values:
```yaml
# When it's a dictionary without any config fields...
dictionary: countries
# When it's a dictionary with config fields...
dictionary:
type: countries
region: Europe
```
-
name: placeholder
type: string
description: |
Set the non-selectable placeholder text. Default: none.
-
name: default
type: string
description: |
Set the default option key. Default: none.
-
name: max_items
type: integer
description: >
Cap the number of selections. Setting this to 1 will change the UI. Default: null (unlimited).
id: 9b14b5b8-6a7a-4db2-8533-9c78faa0e054
---
## Overview
At a glance, the Dictionary fieldtype is similar to the [Select fieldtype](/fieldtypes/select). However, with the Dictionary fieldtype, options aren't manually defined in a field's config, but rather returned from a PHP class (called a "dictionary").
This can prove to be pretty powerful, since it means you can read options from YAML or JSON files, or even hit an external API. It also makes it easier to share common select options between projects.
## Data Storage
Dictionary fields will store the "key" of the chosen option or options.
For example, a dictionary might have items such as:
```php
'jan' => 'January',
'feb' => 'February',
'mar' => 'March',
```
Your saved data will be:
``` yaml
select: jan
```
## Templating
Dictionary fields will return the "option data" returned by the dictionary's `get` method. The shape of this data differs between dictionaries and is outlined below.
For example, using the built-in Countries dictionary, your template might look like this:
```yaml
past_vacations:
- USA
- AUS
- CAN
- DEU
- GBR
```
::tabs
::tab antlers
```antlers
{{ past_vacations }}
{{ emoji }} {{ name }}
{{ /past_vacations }}
```
::tab blade
```blade
@foreach ($past_vacations as $vacation)
{{ $vacation['emoji'] }} {{ $vacation['name'] }}
@endforeach
```
::
```html
🇺🇸 United States
🇦🇺 Australia
🇨🇦 Canada
🇩🇪 Germany
🇬🇧 United Kingdom
```
## Available Dictionaries
Statamic includes a few dictionaries straight out of the box.
### File
This allows you point to a file located in your `resources/dictionaries` directory to populate the options. The file can be `json`, `yaml`, or `csv`.
Each option array should have `label` and `value` keys at the minimum. Any additional keys will be available when templating.
You may redefine which keys are used for the labels and values by providing them to your fieldtype config. In the following example, `name` is the label and `id` is the value.
```json
[
{"name": "Apple", "id": "apple", "emoji": "🍎"},
{"name": "Banana", "id": "banana", "emoji": "🍌"},
{"name": "Cherry", "id": "cherry", "emoji": "🍒"},
...
]
```
```yaml
-
handle: fruit
field:
type: dictionary
dictionary:
type: file
filename: fruit.json
label: name # optional, defaults to "label"
value: id # optional, defaults to "value"
```
You may provide enhanced labels using basic Antlers syntax. For example, to include the emoji before the fruit name, you can do this:
```yaml
label: '{{ emoji }} {{ name }}'
```
### Countries
This provides a list of countries with their ISO codes, region, subregion, and flag emoji.
```yaml
-
handle: countries
field:
type: dictionary
dictionary:
type: countries
region: 'oceania' # Optionally filter the countries by a region.
# Supported options are: africa, americas, asia, europe, oceania, polar
emojis: true # Whether flag emojis are in the labels. They're on by default.
```
```yaml
countries:
- USA
- AUS
```
::tabs
::tab antlers
```antlers
{{ countries }}
{{ emoji }} {{ name }}, {{ iso2 }}, {{ iso3 }}, {{ region }}, {{ subregion }}
{{ /countries }}
```
::tab blade
```blade
@foreach ($countries as $country)
{{ $country['emoji'] }} {{ $country['name'] }}, {{ $country['iso2'] }}, {{ $country['iso3'] }}, {{ $country['region'] }}, {{ $country['subregion'] }}
@endforeach
```
::
```
🇺🇸 United States, US, USA, Americas, Northern America
🇦🇺 Australia, AU, AUS, Oceania, Australia and New Zealand
```
### Timezones
This provides a list of timezones and their UTC offsets.
```yaml
-
handle: timezones
field:
type: dictionary
dictionary:
type: timezones
```
```yaml
timezones:
- America/New_York
- Australia/Sydney
```
::tabs
::tab antlers
```antlers
{{ timezones }}
{{ name }} {{ offset }}
{{ /timezones }}
```
::tab blade
```blade
@foreach ($timezones as $timezone)
{{ $timezone['name'] }} {{ $timezone['offset'] }}
@endforeach
```
::
```
America/New_York -04:00
Australia/Sydney +10:00
```
### Currencies
This provides a list of currencies, with their codes, symbols, and decimals.
```yaml
-
handle: currencies
field:
type: dictionary
dictionary:
type: currencies
```
```yaml
currencies:
- USD
- HUF
```
::tabs
::tab antlers
```antlers
{{ currencies }}
{{ name }}, {{ code }}, {{ symbol }}, {{ decimals }}
{{ /currencies }}
```
::tab blade
```blade
@foreach ($currencies as $currency)
{{ $currency['name'] }}, {{ $currency['code'] }}, {{ $currency['symbol'] }}, {{ $currency['decimals'] }}
@endforeach
```
::
```
US Dollar, USD, $, 2
Hungarian Forint, HUF, Ft, 0
```
## Custom Dictionaries
In many cases, using the native [File](#file) dictionary can be all you need for something custom. However, it's possible to create an entirely custom dictionary that could read from files, APIs, or whatever you can think of.
[Find out how to create a custom dictionary](/extending/dictionaries)
================================================
FILE: content/collections/fieldtypes/entries.md
================================================
---
title: Entries
meta_title: 'Entries Fieldtype'
description: 'Create relationships with other entries.'
intro: |
Create relationships with other entries in one or more collections. It's not very much like online dating because you can create and link the entries on the fly without leaving the page.
screenshot: fieldtypes/screenshots/v6/entries.webp
screenshot_dark: fieldtypes/screenshots/v6/entries-dark.webp
options:
-
name: collections
type: array
description: |
Configure which collections you want to allow relationships with.
-
name: create
type: boolean
description: |
By default you may create new entries. Set to `false` to only allow selecting from existing entries. Only available in the `default` mode.
-
name: max_items
type: integer
description: >
The maximum number of items that may be selected. Setting this to `1` will change the UI to a dropdown.
-
name: mode
type: string
description: |
Set the UI style for this field. Can be one of 'default' (Stack Selector), 'select' (Select Dropdown) or 'typeahead' (Typeahead Field).
-
name: query_scopes
type: string
description: >
Allows you to specify a [query scope](/extending/query-scopes-and-filters#scopes) which should be applied when retrieving selectable entries. You should specify the query scope's handle, which is usually the name of the class in snake case. For example: `MyAwesomeScope` would be `my_awesome_scope`.
-
name: search_index
type: string
description: >
Allows you to specify a [search index](/search#indexes) to be used when searching for entries.
-
name: select_across_sites
type: boolean
description: |
When enabled, entries from all sites will be displayed.
id: acee879a-c832-449d-a714-c57ea5862717
---
## Overview
Use this fieldtype to create a one-way relationship with entries of any collection in your site. It's delightfully simple.
:::watch https://youtube.com/embed/WWbsM5u9afc
Watch how to build a "Related Articles" feature using the Entries Fieldtype
:::
## Data Structure
This fieldtype will store an array of ids to the selected entries. They will be augmented in your Antlers templates to give you access to each entry's data.
``` yaml
related_entries:
- 12f9be1f-a12e-4680-b769-639d2d1f1d14
- ea48926d-bf67-4d45-9420-9627a31c37fb
```
## Templating
Loop through the entries and do anything you want with the data.
::tabs
::tab antlers
```antlers
```
================================================
FILE: content/collections/fieldtypes/float.md
================================================
---
title: Float
description: 'For when all you want is decimal numbers.'
intro: 'The float fieldtype is a text-style input that only accepts floats (numbers) and has increment and decrement controls.'
screenshot: fieldtypes/screenshots/v6/float.webp
screenshot_dark: fieldtypes/screenshots/v6/float-dark.webp
id: 3dcf9495-9a02-4044-b6bb-428b7ff23807
options:
-
name: append
type: string
description: >
Add text after (to the right of) the float input.
-
name: prepend
type: string
description: >
Add text to the beginning (to the left of) the float input.
-
name: placeholder
type: int
description: >
Set a default placeholder value.
-
name: min
type: int
description: >
Set the minimum allowed value.
-
name: max
type: int
description: >
Set the maximum allowed value.
-
name: step
type: int
description: >
Set the interval between valid numbers.
---
## Overview
The float fieldtype is essentially an HTML5 input with `type="number"`. Very similar to the [Integer fieldtype](/fieldtypes/integer), but it allows decimal numbers.
## Data Storage
Stores a float – a decimal number.
================================================
FILE: content/collections/fieldtypes/form.md
================================================
---
id: d630ea15-d94f-4404-84d2-0926a898e672
blueprint: fieldtype
title: Form
screenshot: fieldtypes/screenshots/v6/form.webp
screenshot_dark: fieldtypes/screenshots/v6/form-dark.webp
description: 'Pick a form, any form.'
overview: |
Use this fieldtype to create a relationship with one of your site's [forms](/forms).
options:
-
name: max_items
type: integer
required: false
description: 'The maximum number of forms that may be selected.'
-
name: placeholder
type: string
description: |
Set the non-selectable placeholder text. Default: none.
-
name: query_scopes
type: string
description: >
Allows you to specify a [query scope](/extending/query-scopes-and-filters#scopes) which should be applied when retrieving selectable assets. You should specify the query scope's handle, which is usually the name of the class in snake case. For example: `MyAwesomeScope` would be `my_awesome_scope`.
related_entries:
- fdb45b84-3568-437d-84f7-e3c93b6da3e6
- aa96fcf1-510c-404b-9b63-cea8942e1bf8
---
## Overview
The Form fieldtype is gives your users a way to pick a form to include along with the current entry. How that form is implemented or shows up on the page is up to you.
## Data Storage
The Form fieldtype stores the `handle` of a single form as a string, or an array of handles if `max_items` is greater than 1.
## Templating
The Form fieldtype provides a few useful variables:
* `handle`
* `title`
* `fields`
* `api_url`
* `honeypot`
You can use the [`form:create`](/tags/form-create) tag to render a `