1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-18 19:01:40 +02:00

feat(core): Decouple settings for system plugins from the engine core. #368

BREAKING CHANGE:

this settings will be stored in the **flextype.***

```
# Set the timezone to be used on the website.
# For a list of valid timezone settings, see:
# http://php.net/manual/en/timezones.php
timezone: UTC

# Charset
#
# Set internal character encoding.
#
# Currently the following names are supported:
# http://php.net/manual/en/function.mb-regex-encoding.php#121645
charset: UTF-8

# The theme to use.
#
# Don't edit the provided theme templates directly, because they get updated
# in next releases. If you wish to modify a default theme, copy its folder, and
# change the name here accordingly.
theme: default

# The locale that'll be used by the Flextype.
locale: en_US

# Valid date format
#
# - date_format: Valid date format
#
# - date_display_format: Valid date format to display
date_format: 'd-m-Y H:i'
date_display_format: 'd-m-y G:i'

# The entries settings§
#
# - main:        Main entry
# - media.upload_images_quality: Image quality
# - media.accept_file_types: Define the file types (extensions to be exact) that are acceptable for upload.
entries:
  main: home
  error404:
    title: Error 404
    description: We're sorry but the page you are looking for doesn't appear to exist!
    content: "<center>We're sorry but the page you are looking for doesn't appear to exist!</center>"
    template: default

# Display errors
#
# - display: Display errors or not.
errors:
  display: false

# Cache
#
# - enabled:         Set to true to enable caching
#
# - prefix:          Cache prefix string (prevents cache conflicts)
#
# - driver:          Available drivers: auto (will get one from installed cache drivers), apcu,
#                    apc, array, wincache, xcache, memcache, memcached, redis, file.
#
# - lifetime:        Lifetime of cached data in seconds
#
# - redis.socket:    Path to redis unix socket (e.g. /var/run/redis/redis.sock),
#                    false = use server and port to connect
#
# - redis.password   Redis password
#
# - redis.server     Redis server
#
# - redis.port       Redis port
#
# - memcache.server  Memcache server
#
# - memcache.port    Memcache port
#
# - memcached.server Memcached server
#
# - memcached.port   Memcached port
#
# - sqlite3.database SQLite3 Database
#
# - sqlite3.table    SQLite3 Table
cache:
  enabled: true
  prefix: flextype
  driver: auto
  lifetime: 604800
  memcache:
    server: localhost
    port: 11211
  memcached:
    server: localhost
    port: 11211
  redis:
    socket: false
    password: false
    server: localhost
    port: 6379
  sqlite3:
    database: flextype
    table: flextype

# Whoops
#
# - editor: emacs, idea, macvim, phpstorm, sublime, textmate, xdebug, vscode, atom, espresso
#
# - page_title: page title
whoops:
  editor: atom
  page_title: Error!

# Slim
#
# - display_error_details: When true, additional information about exceptions are
#                          displayed by the default error handler.
#
# - add_content_length_header: When true, Slim will add a Content-Length header to
#                              the response. If you are using a runtime analytics tool,
#                              such as New Relic, then this should be disabled.
#
# - router_cache_file: Filename for caching the FastRoute routes. Must be set to
#                      a valid filename within a writeable directory. If the file
#                      does not exist, then it is created with the correct cache
#                      information on first run. Set to false to disable the FastRoute
#                      cache system.
#
# - determine_route_before_app_middleware: When true, the route is calculated before
#                                          any middleware is executed. This means that you
#                                          can inspect route parameters in middleware if you need to.
#
# - output_buffering: If false, then no output buffering is enabled.
#                     If 'append' or 'prepend', then any echo or print statements
#                     are captured and are either appended or prepended to the Response
#                     returned from the route callable.
#
# - response_chunk_size: Size of each chunk read from the Response body when sending to the browser.
#
# - http_version: The protocol version used by the Response object.
display_error_details: false
add_content_length_header: true
router_cache_file: false
determine_route_before_app_middleware: false
output_buffering: append
response_chunk_size: 4096
http_version: '1.1'

# Twig
#
# - auto_reload: When developing with Twig, it's useful to recompile the template
#                whenever the source code changes. If you don't provide a value
#                for the auto_reload option, it will be determined automatically
#                based on the debug value.
#
# - debug:       When set to true, the generated templates have a __toString()
#                method that you can use to display the generated nodes
#
# - charset:     The charset used by the templates.
#
# - cache:       Set false to disable caching.
#
# - extensions   Flextype Twig Extension to load.
twig:
  auto_reload: true
  cache: true
  debug: false
  charset: "UTF-8"
  extensions: ['Cache', 'Entries', 'Emitter', 'Flash', 'I18n', 'Json', 'Yaml', 'Parser', 'Markdown', 'Filesystem', 'Date', 'Assets', 'Csrf', 'Shortcodes', 'Snippets', 'GlobalVars']

# Slugify
#
# - separator: By default Slugify will use dashes as separators.
#              If you want to use a different default separator,
#              you can set the separator option.
#
# - lowercase: By default Slugify will convert the slug to lowercase.
#              If you want to preserve the case of the string you can set the
#              lowercase option to false.
#
# - trim:      By default Slugify will remove leading and trailing separators before
#              returning the slug. If you do not want the slug to be trimmed you can
#              set the trim option to false.
#
# - regexp:    You can also change the regular expression that is used to replace
#              characters with the separator.
#
# - lowercase_after_regexp: Lowercasing is done before using the regular expression.
#                           If you want to keep the lowercasing behavior but your
#                           regular expression needs to match uppercase letters,
#                           you can set the lowercase_after_regexp option to true.
#
# - strip_tags: Adds in an option to go through strip_tags() in case the string contains HTML etc.
slugify:
  separator: "-"
  lowercase: true
  trim: true
  regexp: "/[^A-Za-z0-9]+/"
  lowercase_after_regexp: false
  strip_tags: false

# Image
#
# - driver: gd or imagick
image:
  driver: gd

# Shortcodes
#
# - extensions: Flextype Shortcodes Extension to load.
shortcodes:
  extensions: ['BaseUrl', 'Entries', 'Registry', 'Snippets']

```
This commit is contained in:
Awilum
2020-02-14 21:36:46 +03:00
parent 9b2c7de999
commit b08b322aa5
16 changed files with 84 additions and 85 deletions

View File

@@ -42,70 +42,70 @@ Session::start();
$registry = new Registry();
/**
* Load core settings
* Load flextype settings
*
* 1. Set settings files paths.
* 2. Load system default and site settings files.
* 2. Load flextype default and flextype custom settings files.
* 3. Merge settings.
* 4. Add settings into the registry.
*/
$default_settings_file_path = PATH['config']['default'] . '/settings.yaml';
$site_settings_file_path = PATH['config']['site'] . '/settings.yaml';
$default_flextype_settings_file_path = PATH['config']['default'] . '/settings.yaml';
$custom_flextype_settings_file_path = PATH['config']['site'] . '/settings.yaml';
// Set settings if Flextype settings and Site settings config files exist
if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_settings_file_path)) {
throw new RuntimeException('Flextype settings or Site settings config files does not exist.');
// Set settings if Flextype Default settings and Flextype Custom settings config files exist
if (! Filesystem::has($default_flextype_settings_file_path) || ! Filesystem::has($custom_flextype_settings_file_path)) {
throw new RuntimeException('Flextype Default settings or Flextype Custom settings config files does not exist.');
}
if (($content = Filesystem::read($default_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!');
if (($content = Filesystem::read($default_flextype_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $default_flextype_settings_file_path . ' - failed!');
} else {
if (trim($content) === '') {
$default_settings = [];
$default_flextype_settings = [];
} else {
$default_settings = Yaml::decode($content);
$default_flextype_settings = Yaml::decode($content);
}
}
if (($content = Filesystem::read($site_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!');
if (($content = Filesystem::read($custom_flextype_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $custom_flextype_settings_file_path . ' - failed!');
} else {
if (trim($content) === '') {
$site_settings = [];
$custom_flextype_settings = [];
} else {
$site_settings = Yaml::decode($content);
$custom_flextype_settings = Yaml::decode($content);
}
}
// Merge settings
$settings = array_replace_recursive($default_settings, $site_settings);
// Merge flextype settings
$flextype_settings = array_replace_recursive($default_flextype_settings, $custom_flextype_settings);
// Set settings
$registry->set('settings', $settings);
// Set flextype settings
$registry->set('flextype', $flextype_settings);
/**
* Create new application
*/
$app = new App([
'settings' => [
'debug' => $registry->get('settings.errors.display'),
'whoops.editor' => $registry->get('settings.whoops.editor'),
'whoops.page_title' => $registry->get('settings.whoops.page_title'),
'displayErrorDetails' => $registry->get('settings.display_error_details'),
'addContentLengthHeader' => $registry->get('settings.add_content_length_header'),
'routerCacheFile' => $registry->get('settings.router_cache_file'),
'determineRouteBeforeAppMiddleware' => $registry->get('settings.determine_route_before_app_middleware'),
'outputBuffering' => $registry->get('settings.output_buffering'),
'responseChunkSize' => $registry->get('settings.response_chunk_size'),
'httpVersion' => $registry->get('settings.http_version'),
'debug' => $registry->get('flextype.errors.display'),
'whoops.editor' => $registry->get('flextype.whoops.editor'),
'whoops.page_title' => $registry->get('flextype.whoops.page_title'),
'displayErrorDetails' => $registry->get('flextype.display_error_details'),
'addContentLengthHeader' => $registry->get('flextype.add_content_length_header'),
'routerCacheFile' => $registry->get('flextype.router_cache_file'),
'determineRouteBeforeAppMiddleware' => $registry->get('flextype.determine_route_before_app_middleware'),
'outputBuffering' => $registry->get('flextype.output_buffering'),
'responseChunkSize' => $registry->get('flextype.response_chunk_size'),
'httpVersion' => $registry->get('flextype.http_version'),
'twig' => [
'charset' => $registry->get('settings.twig.charset'),
'debug' => $registry->get('settings.twig.debug'),
'cache' => $registry->get('settings.twig.cache') ? PATH['cache'] . '/twig' : false,
'auto_reload' => $registry->get('settings.twig.auto_reload'),
'charset' => $registry->get('flextype.twig.charset'),
'debug' => $registry->get('flextype.twig.debug'),
'cache' => $registry->get('flextype.twig.cache') ? PATH['cache'] . '/twig' : false,
'auto_reload' => $registry->get('flextype.twig.auto_reload'),
],
'images' => [
'driver' => $registry->get('settings.image.driver'),
'driver' => $registry->get('flextype.image.driver'),
],
],
]);
@@ -135,13 +135,13 @@ include_once 'api/delivery/entries.php';
* Set internal encoding
*/
function_exists('mb_language') and mb_language('uni');
function_exists('mb_regex_encoding') and mb_regex_encoding($flextype['registry']->get('settings.charset'));
function_exists('mb_internal_encoding') and mb_internal_encoding($flextype['registry']->get('settings.charset'));
function_exists('mb_regex_encoding') and mb_regex_encoding($flextype['registry']->get('flextype.charset'));
function_exists('mb_internal_encoding') and mb_internal_encoding($flextype['registry']->get('flextype.charset'));
/**
* Display Errors
*/
if ($flextype['registry']->get('settings.errors.display')) {
if ($flextype['registry']->get('flextype.errors.display')) {
/**
* Add WhoopsMiddleware
@@ -154,14 +154,14 @@ if ($flextype['registry']->get('settings.errors.display')) {
/**
* Set default timezone
*/
date_default_timezone_set($flextype['registry']->get('settings.timezone'));
date_default_timezone_set($flextype['registry']->get('flextype.timezone'));
/**
* Init shortocodes
*
* Load Flextype Shortcodes extensions from directory /flextype/shortcodes/ based on settings.shortcodes.extensions array
*/
$shortcodes_extensions = $flextype['registry']->get('settings.shortcodes.extensions');
$shortcodes_extensions = $flextype['registry']->get('flextype.shortcodes.extensions');
foreach($shortcodes_extensions as $shortcodes_extension) {
$shortcodes_extension_file_path = ROOT_DIR . '/flextype/shortcodes/' . $shortcodes_extension . 'ShortcodeExtension.php';

View File

@@ -19,8 +19,8 @@ class MemcachedAdapter implements CacheAdapterInterface
{
$memcached = new Memecached();
$memcached->addServer(
$this->flextype['registry']->get('settings.cache.memcached.server', 'localhost'),
$this->flextype['registry']->get('settings.cache.memcache.port', 11211)
$this->flextype['registry']->get('flextype.cache.memcached.server', 'localhost'),
$this->flextype['registry']->get('flextype.cache.memcache.port', 11211)
);
$driver = new MemcachedCache();

View File

@@ -19,15 +19,15 @@ class RedisAdapter implements CacheAdapterInterface
public function getDriver() : object
{
$redis = new Redis();
$socket = $this->flextype['registry']->get('settings.cache.redis.socket', false);
$password = $this->flextype['registry']->get('settings.cache.redis.password', false);
$socket = $this->flextype['registry']->get('flextype.cache.redis.socket', false);
$password = $this->flextype['registry']->get('flextype.cache.redis.password', false);
if ($socket) {
$redis->connect($socket);
} else {
$redis->connect(
$this->flextype['registry']->get('settings.cache.redis.server', 'localhost'),
$this->flextype['registry']->get('settings.cache.redis.port', 6379)
$this->flextype['registry']->get('flextype.cache.redis.server', 'localhost'),
$this->flextype['registry']->get('flextype.cache.redis.port', 6379)
);
}

View File

@@ -24,8 +24,8 @@ class SQLite3Adapter implements CacheAdapterInterface
Filesystem::createDir($cache_directory);
}
$db = new SQLite3($cache_directory . $this->flextype['registry']->get('settings.cache.sqlite3.database', 'flextype') . '.db');
$db = new SQLite3($cache_directory . $this->flextype['registry']->get('flextype.cache.sqlite3.database', 'flextype') . '.db');
return new SQLite3Cache($db, $this->flextype['registry']->get('settings.cache.sqlite3.table', 'flextype'));
return new SQLite3Cache($db, $this->flextype['registry']->get('flextype.cache.sqlite3.table', 'flextype'));
}
}

View File

@@ -67,7 +67,7 @@ class Cache
$this->now = time();
// Create cache key to allow invalidate all cache on configuration changes.
$this->key = ($this->flextype['registry']->get('settings.cache.prefix') ?? 'flextype') . '-' . md5(PATH['site'] . 'Flextype::VERSION');
$this->key = ($this->flextype['registry']->get('flextype.cache.prefix') ?? 'flextype') . '-' . md5(PATH['site'] . 'Flextype::VERSION');
// Get Cache Driver
$this->driver = $this->getCacheDriver();
@@ -117,7 +117,7 @@ class Cache
*/
public function fetch(string $id)
{
if ($this->flextype['registry']->get('settings.cache.enabled')) {
if ($this->flextype['registry']->get('flextype.cache.enabled')) {
return $this->driver->fetch($id);
}
@@ -133,7 +133,7 @@ class Cache
*/
public function contains(string $id) : bool
{
if ($this->flextype['registry']->get('settings.cache.enabled')) {
if ($this->flextype['registry']->get('flextype.cache.enabled')) {
return $this->driver->contains($id);
}
@@ -153,7 +153,7 @@ class Cache
*/
public function save(string $id, $data, ?int $lifetime = null) : void
{
if (! $this->flextype['registry']->get('settings.cache.enabled')) {
if (! $this->flextype['registry']->get('flextype.cache.enabled')) {
return;
}
@@ -168,7 +168,7 @@ class Cache
*/
public function delete(string $id) : void
{
if (! $this->flextype['registry']->get('settings.cache.enabled')) {
if (! $this->flextype['registry']->get('flextype.cache.enabled')) {
return;
}
@@ -237,7 +237,7 @@ class Cache
public function getLifetime()
{
if ($this->lifetime === null) {
$this->lifetime = $this->flextype['registry']->get('settings.cache.lifetime') ?: 604800;
$this->lifetime = $this->flextype['registry']->get('flextype.cache.lifetime') ?: 604800;
}
return $this->lifetime;

View File

@@ -474,8 +474,8 @@ class Entries
// Check if new entry file exists
if (! Filesystem::has($entry_file = $entry_dir . '/entry.md')) {
$data['uuid'] = Uuid::uuid4()->toString();
$data['published_at'] = date($this->flextype->registry->get('settings.date_format'), time());
$data['created_at'] = date($this->flextype->registry->get('settings.date_format'), time());
$data['published_at'] = date($this->flextype->registry->get('flextype.date_format'), time());
$data['created_at'] = date($this->flextype->registry->get('flextype.date_format'), time());
$data['published_by'] = (Session::exists('uuid') ? Session::get('uuid') : '');
$data['created_by'] = (Session::exists('uuid') ? Session::get('uuid') : '');

View File

@@ -103,7 +103,7 @@ class Parser
{
switch ($parser) {
case 'frontmatter':
if ($cache === true && $this->flextype['registry']->get('settings.cache.enabled') === true) {
if ($cache === true && $this->flextype['registry']->get('flextype.cache.enabled') === true) {
$key = md5($input);
if ($data_from_cache = $this->flextype['cache']->fetch($key)) {
@@ -120,7 +120,7 @@ class Parser
break;
case 'json':
if ($cache === true && $this->flextype['registry']->get('settings.cache.enabled') === true) {
if ($cache === true && $this->flextype['registry']->get('flextype.cache.enabled') === true) {
$key = md5($input);
if ($data_from_cache = $this->flextype['cache']->fetch($key)) {
@@ -137,7 +137,7 @@ class Parser
break;
case 'yaml':
if ($cache === true && $this->flextype['registry']->get('settings.cache.enabled') === true) {
if ($cache === true && $this->flextype['registry']->get('flextype.cache.enabled') === true) {
$key = md5($input);
if ($data_from_cache = $this->flextype['cache']->fetch($key)) {
@@ -154,7 +154,7 @@ class Parser
break;
case 'markdown':
if ($cache === true && $this->flextype['registry']->get('settings.cache.enabled') === true) {
if ($cache === true && $this->flextype['registry']->get('flextype.cache.enabled') === true) {
$key = md5($input);
if ($data_from_cache = $this->flextype['cache']->fetch($key)) {

View File

@@ -68,7 +68,7 @@ class Plugins
$this->flextype['registry']->set('plugins', []);
// Set locale
$locale = $this->flextype['registry']->get('settings.locale');
$locale = $this->flextype['registry']->get('flextype.locale');
// Get plugins list
$plugins_list = $this->getPluginsList();

View File

@@ -88,12 +88,12 @@ $flextype['emitter'] = static function ($container) {
*/
$flextype['slugify'] = static function ($container) {
return new Slugify([
'separator' => $container['registry']->get('settings.slugify.separator'),
'lowercase' => $container['registry']->get('settings.slugify.lowercase'),
'trim' => $container['registry']->get('settings.slugify.trim'),
'regexp' => $container['registry']->get('settings.slugify.regexp'),
'lowercase_after_regexp' => $container['registry']->get('settings.slugify.lowercase_after_regexp'),
'strip_tags' => $container['registry']->get('settings.slugify.strip_tags'),
'separator' => $container['registry']->get('flextype.slugify.separator'),
'lowercase' => $container['registry']->get('flextype.slugify.lowercase'),
'trim' => $container['registry']->get('flextype.slugify.trim'),
'regexp' => $container['registry']->get('flextype.slugify.regexp'),
'lowercase_after_regexp' => $container['registry']->get('flextype.slugify.lowercase_after_regexp'),
'strip_tags' => $container['registry']->get('flextype.slugify.strip_tags'),
]);
};
@@ -108,7 +108,7 @@ $flextype['flash'] = static function ($container) {
* Adds the cache adapter to the Flextype container
*/
$flextype['cache_adapter'] = static function ($container) use ($flextype) {
$driver_name = $container['registry']->get('settings.cache.driver');
$driver_name = $container['registry']->get('flextype.cache.driver');
if (! $driver_name || $driver_name === 'auto') {
if (extension_loaded('apcu')) {
@@ -245,7 +245,7 @@ $flextype['view'] = static function ($container) {
$view->addExtension(new DebugExtension());
// Load Flextype Twig extensions from directory /flextype/twig/ based on settings.twig.extensions array
$twig_extensions = $container['registry']->get('settings.twig.extensions');
$twig_extensions = $container['registry']->get('flextype.twig.extensions');
foreach($twig_extensions as $twig_extension) {

View File

@@ -182,7 +182,7 @@ class ApiController extends Controller
$uuid = Uuid::uuid4()->toString();
// Get time
$time = date($this->registry->get('settings.date_format'), time());
$time = date($this->registry->get('flextype.date_format'), time());
// Create API Token account
if (Filesystem::write(
@@ -276,7 +276,7 @@ class ApiController extends Controller
'created_by' => $post_data['created_by'],
'created_at' => $post_data['created_at'],
'updated_by' => Session::get('uuid'),
'updated_at' => date($this->registry->get('settings.date_format'), time()),
'updated_at' => date($this->registry->get('flextype.date_format'), time()),
], 'yaml')
)) {
$this->flash->addMessage('success', __('admin_message_' . $post_data['api'] . '_api_token_updated'));

View File

@@ -227,7 +227,7 @@ class EntriesController extends Controller
// We need to check if template for current fieldset is exists
// if template is not exist then `default` template will be used!
$template_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/templates/' . $data['fieldset'] . '.html';
$template_path = PATH['themes'] . '/' . $this->registry->get('flextype.theme') . '/templates/' . $data['fieldset'] . '.html';
$template = (Filesystem::has($template_path)) ? $data['fieldset'] : 'default';
// Init entry data
@@ -442,7 +442,7 @@ class EntriesController extends Controller
if ($_entry['slug'] != '') {
$entries_list[$_entry['slug']] = $_entry['slug'];
} else {
$entries_list[$this->registry->get('settings.entries.main')] = $this->registry->get('settings.entries.main');
$entries_list[$this->registry->get('flextype.entries.main')] = $this->registry->get('flextype.entries.main');
}
}
@@ -1094,9 +1094,8 @@ class EntriesController extends Controller
if ($post_data['id'] == '') {
$data = [];
Arr::set($data, 'entries.items_view_default', $post_data['items_view']);
//$this->registry->get('settings')
Filesystem::write(PATH['config']['site'] . '/settings.yaml', $this->parser->encode(array_replace_recursive($this->registry->get('settings'), $data), 'yaml'));
Arr::set($data, 'plugins.admin.entries.items_view_default', $post_data['items_view']);
//Filesystem::write(PATH['config']['site'] . '/settings.yaml', $this->parser->encode(array_replace_recursive($this->registry->get('settings'), $data), 'yaml'));
} else {
$this->entries->update($post_data['id'], ['items_view' => $post_data['items_view']]);
}

View File

@@ -261,7 +261,7 @@ class TemplatesController extends Controller
$theme = $request->getParsedBody()['theme'];
$type = $request->getParsedBody()['type_current'];
if (! Filesystem::has(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) {
if (! Filesystem::has(PATH['themes'] . '/' . $this->registry->get('flextype.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) {
if (Filesystem::rename(
PATH['themes'] . '/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html',
PATH['themes'] . '/' . $theme . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html'

View File

@@ -134,7 +134,7 @@ class UsersController extends Controller
$uuid = Uuid::uuid4()->toString();
// Get time
$time = date($this->registry->get('settings.date_format'), time());
$time = date($this->registry->get('flextype.date_format'), time());
// Create accounts directory and account
Filesystem::createDir(PATH['site'] . '/accounts/');

View File

@@ -15,7 +15,7 @@ use Flextype\Component\I18n\I18n;
use function Flextype\Component\I18n\__;
// Set Default Admin locale
I18n::$locale = $flextype->registry->get('settings.locale');
I18n::$locale = $flextype->registry->get('flextype.locale');
// Add Admin Navigation
$flextype->registry->set('admin_navigation.content.entries', ['title' => __('admin_entries'), 'icon' => 'fas fa-database', 'link' => $flextype->router->pathFor('admin.entries.index')]);

View File

@@ -311,7 +311,7 @@ class FormController extends Controller
$name = isset($properties['name']) ? $properties['name'] : $field_name;
$current_value = isset($properties['value']) ? $properties['value'] : $field_value;
$_templates_list = $this->flextype['themes']->getTemplates($this->flextype['registry']->get('settings.theme'));
$_templates_list = $this->flextype['themes']->getTemplates($this->flextype['registry']->get('flextype.theme'));
$options = [];

View File

@@ -45,7 +45,7 @@ class SiteController extends Controller
// If uri is empty then it is main entry else use entry uri
if ($uri === '/') {
$entry_uri = $this->registry->get('settings.entries.main');
$entry_uri = $this->registry->get('flextype.entries.main');
} else {
$entry_uri = ltrim($uri, '/');
}
@@ -87,7 +87,7 @@ class SiteController extends Controller
}
// Set template path for current entry
$path = 'themes/' . $this->registry->get('settings.theme') . '/' . (empty($this->entry['template']) ? 'templates/default' : 'templates/' . $this->entry['template']) . '.html';
$path = 'themes/' . $this->registry->get('flextype.theme') . '/' . (empty($this->entry['template']) ? 'templates/default' : 'templates/' . $this->entry['template']) . '.html';
if ($is_entry_not_found) {
return $this->view->render($response->withStatus(404), $path, ['entry' => $this->entry, 'query' => $query, 'uri' => $uri]);
@@ -106,10 +106,10 @@ class SiteController extends Controller
public function error404() : array
{
return [
'title' => $this->registry->get('settings.entries.error404.title'),
'description' => $this->registry->get('settings.entries.error404.description'),
'content' => $this->registry->get('settings.entries.error404.content'),
'template' => $this->registry->get('settings.entries.error404.template'),
'title' => $this->registry->get('flextype.entries.error404.title'),
'description' => $this->registry->get('flextype.entries.error404.description'),
'content' => $this->registry->get('flextype.entries.error404.content'),
'template' => $this->registry->get('flextype.entries.error404.template'),
];
}
}