Skip to content

Commit

Permalink
Change of approach
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Feb 1, 2024
1 parent 6080b26 commit c4c1b86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Http/Controllers/CP/Taxonomies/TaxonomiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public function edit($taxonomy)
'collections' => $taxonomy->collections()->map->handle()->all(),
'sites' => $taxonomy->sites()->all(),
'preview_targets' => $taxonomy->basePreviewTargets(),
'term_template' => $taxonomy->termTemplate,
'template' => $taxonomy->template,
'term_template' => $taxonomy->hasCustomTermTemplate() ? $taxonomy->termTemplate() : null,
'template' => $taxonomy->hasCustomTemplate() ? $taxonomy->template() : null,
'layout' => $taxonomy->layout(),
];

Expand Down
14 changes: 12 additions & 2 deletions src/Taxonomies/Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Taxonomy implements Arrayable, ArrayAccess, AugmentableContract, Contract,
protected $revisions = false;
protected $searchIndex;
protected $previewTargets = [];
public $template;
public $termTemplate;
protected $template;
protected $termTemplate;
protected $layout;
protected $afterSaveCallbacks = [];
protected $withEvents = true;
Expand Down Expand Up @@ -518,4 +518,14 @@ private function previewTargetsForFile()
];
})->filter()->values()->all();
}

public function hasCustomTemplate()
{
return $this->template !== null;
}

public function hasCustomTermTemplate()
{
return $this->termTemplate !== null;
}
}

0 comments on commit c4c1b86

Please sign in to comment.