Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IGNITION_LOCAL_SITES_PATH=/Users/<project-path>/site/web/app/themes/lumberjack
2 changes: 1 addition & 1 deletion 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ class Error404Controller extends Controller
{
public function handle()
{
return new TimberResponse('templates/errors/404.twig', Timber::get_context(), 404);
return new TimberResponse('templates/errors/404.twig', Timber::context(), 404);
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class IndexController
{
public function handle()
{
$context = Timber::get_context();
$context = Timber::context();
$context['posts'] = Post::whereStatus('publish')
->limit(5)
->get();
Expand Down
5 changes: 4 additions & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@

class Handler extends LumberjackHandler
{
#[\Override]
protected $dontReport = [];

#[\Override]
public function report(Exception $e)
{
parent::report($e);
}

#[\Override]
public function render(ServerRequestInterface $request, Exception $e): ResponseInterface
{
// Provide a customisable error rendering when not in debug mode
try {
if (Config::get('app.debug') === false) {
$data = Timber::get_context();
$data = Timber::context();
$data['exception'] = $e;

return new TimberResponse('templates/errors/whoops.twig', $data, 500);
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Lumberjack.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Rareloop\Lumberjack\Http\Lumberjack as LumberjackCore;
use App\Menu\Menu;
use Timber\Timber;

class Lumberjack extends LumberjackCore
{
Expand All @@ -18,7 +19,7 @@ public function addToContext($context)
// the context, you can get items from it in a way that is a little smoother and more
// versatile than Wordpress's wp_nav_menu. (You need never again rely on a
// crazy "Walker Function!")
$context['menu'] = new Menu('main-nav');
$context['menu'] = Timber::get_menu('main-nav');

return $context;
}
Expand Down
7 changes: 4 additions & 3 deletions app/Menu/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

namespace App\Menu;

use Timber\Menu as TimberMenu;
use Timber\MenuItem as TimberMenuItem;
use WP_Post;

class Item extends TimberMenuItem
{
public $PostClass = 'Rareloop\Lumberjack\Post';
public $listItemClass = 'page-list__item';

public function __construct($data)
public function __construct(?WP_Post $data = null, ?TimberMenu $menu = null)
{
parent::__construct($data);
parent::__construct($data, $menu);

// Add a modifier class if the item is the current page
if ($data->current) {
Expand Down
6 changes: 1 addition & 5 deletions app/Menu/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@

use Timber\Menu as TimberMenu;

class Menu extends TimberMenu
{
public $MenuItemClass = 'App\Menu\Item';
public $PostClass = 'Rareloop\Lumberjack\Post';
}
class Menu extends TimberMenu {}
16 changes: 13 additions & 3 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,31 @@

namespace App\Providers;

use App\Menu\Item;
use App\Menu\Menu;
use Rareloop\Lumberjack\Page;
use Rareloop\Lumberjack\Post;
use Rareloop\Lumberjack\Providers\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any app specific items into the container
*/
public function register()
{
}
public function register() {}

/**
* Perform any additional boot required for this application
*/
public function boot()
{
add_filter('timber/post/classmap', fn($classmap) => [
...$classmap,
Post::getPostType() => Post::class,
Page::getPostType() => Page::class,
]);

add_filter('timber/menu/class', fn() => Menu::class);
add_filter('timber/menuitem/class', fn() => Item::class);
}
}
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ArchiveController extends Controller
{
public function handle()
{
$data = Timber::get_context();
$data = Timber::context();
$data['title'] = 'Archive';

if (is_day()) {
Expand Down
2 changes: 1 addition & 1 deletion author.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function handle()
{
global $wp_query;

$data = Timber::get_context();
$data = Timber::context();
$author = new TimberUser($wp_query->query_vars['author']);

$data['author'] = $author;
Expand Down
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@
}
],
"keywords": [
"lumberjack", "composer", "wordpress", "wp", "theme", "timber", "twig", "mvc", "dry"
"lumberjack",
"composer",
"wordpress",
"wp",
"theme",
"timber",
"twig",
"mvc",
"dry"
],
"require": {
"php": ">=8.3",
"composer/installers": "^1.0"
}
}
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'logs' => [
'enabled' => true,
'path' => false,
'level' => Monolog\Logger::ERROR,
'level' => Monolog\Level::Error,
],

'themeSupport' => [
Expand Down
166 changes: 166 additions & 0 deletions config/ignition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?php

use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\MergeConflictSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\UndefinedPropertySolutionProvider;

return [

/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "textmate", "emacs",
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
| "xdebug", "phpstorm-remote"
|
*/

'editor' => env('IGNITION_EDITOR', 'vscode'),

/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/

'theme' => env('IGNITION_THEME', 'auto'),

/*
|--------------------------------------------------------------------------
| Solution Providers
|--------------------------------------------------------------------------
|
| List of solution providers that should be loaded. You may specify additional
| providers as fully qualified class names.
|
*/

'solution_providers' => [
// from spatie/ignition
BadMethodCallSolutionProvider::class,
MergeConflictSolutionProvider::class,
UndefinedPropertySolutionProvider::class,
],

/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/

'ignored_solution_providers' => [],

/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. By default, runnable solutions are only enabled when your
| app has debug mode enabled and the environment is `local` or
| `development`.
|
| Using the `IGNITION_ENABLE_RUNNABLE_SOLUTIONS` environment variable, you
| can override this behaviour and enable or disable runnable solutions
| regardless of the application's environment.
|
| Default: env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS')
|
*/

'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', 'false'),

/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/

'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', dirname(__DIR__)),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),

/*
|--------------------------------------------------------------------------
| Recorders
|--------------------------------------------------------------------------
|
| Ignition registers a couple of recorders when it is enabled. Below you may
| specify a recorders will be used to record specific events.
|
*/

'recorders' => [],

/*
* When a key is set, we'll send your exceptions to Open AI to generate a solution
*/

'open_ai_key' => env('IGNITION_OPEN_AI_KEY'),

/*
|--------------------------------------------------------------------------
| Include arguments
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. This feature can be disabled here.
|
*/

'with_stack_frame_arguments' => true,

/*
|--------------------------------------------------------------------------
| Argument reducers
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. To make these variables more readable, you can
| specify a list of classes here which summarize the variables.
|
*/

'argument_reducers' => [
\Spatie\Backtrace\Arguments\Reducers\BaseTypeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ArrayArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StdClassArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\EnumArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ClosureArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeZoneArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\SymphonyRequestArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StringableArgumentReducer::class,
],

];
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IndexController extends Controller
{
public function handle()
{
$context = Timber::get_context();
$context = Timber::context();
$context['posts'] = Post::all();

return new TimberResponse('templates/posts.twig', $context);
Expand Down
5 changes: 2 additions & 3 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@

use App\Http\Controllers\Controller;
use Rareloop\Lumberjack\Http\Responses\TimberResponse;
use Rareloop\Lumberjack\Page;
use Timber\Timber;

class PageController extends Controller
{
public function handle()
{
$context = Timber::get_context();
$page = new Page();
$context = Timber::context();
$page = Timber::get_post();

$context['post'] = $page;
$context['title'] = $page->title;
Expand Down
2 changes: 1 addition & 1 deletion routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Rareloop\Lumberjack\Facades\Router;
use Zend\Diactoros\Response\HtmlResponse;
use Laminas\Diactoros\Response\HtmlResponse;

// Router::get('hello-world', function () {
// return new HtmlResponse('<h1>Hello World!</h1>');
Expand Down
2 changes: 1 addition & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SearchController extends Controller
{
public function handle()
{
$context = Timber::get_context();
$context = Timber::context();
$searchQuery = get_search_query();

$context['title'] = 'Search results for \'' . htmlspecialchars($searchQuery) . '\'';
Expand Down
Loading