code-lts / doctum

A php API documentation generator, fork of Sami

Home Page:https://doctum.long-term.support/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a custom theme?

iseries opened this issue · comments

Hello,
after read the docs, i still don't get how to create my own custom theme.
It is noticed that "a theme is just a directory with a manifest.yml". So i created a folder with a manifest.yml file in the documentRoot where doctum.phar and config.php is stored. When trying to build with doctum.phar update /path/to/config.php -v it outputs a message, that my custom theme could not found.

My question is: Where do I have to put the theme folder to be recognized?

Best,
Rene

Hello Rene,
could you send the contents of the Manifest file?
I think it may be because you are using a phar maybe you need to change the theme path to a full path
Can you also send your config file?

Hi @williamdes ,

my config.php:

<?php

declare(strict_types = 1);

use Doctum\Doctum;
use Doctum\RemoteRepository\GitHubRemoteRepository;
use Doctum\Version\GitVersionCollection;
use Symfony\Component\Finder\Finder;

$iterator = Finder::create()
    ->files()
    ->name('*.php')
    ->exclude('Resources')
    ->exclude('Tests')
    ->in($dir = '/usr/home/renerk/public_html/neosdoc/neos-development-collection');

return new Doctum($iterator, [
    'title' => 'Neos 8.2 API',
    'theme' => 'neos',
    'build_dir' => __DIR__ . '/build/neos/%version%',
    'cache_dir' => __DIR__ . '/cache/neos/%version%',
    'default_opened_level' => 2,
    ]
);

my manifest.yml:

name: neos
parent: default

My folder structure:
image

Edit:

Tried to set the full path:
image

Hi @iseries
I am sorry I did not manage to reply earlier, I think this is due to the fact you use a PHAR. If you use the composer version it should work without issues. I will keep this pinned down to see if I find a proper patch for this case

Hi @iseries
I found what you need to do, it's adding a template_dirs variable

return new Doctum($iterator, [
    'title' => 'Neos 8.2 API',
    'theme' => 'neos',
    'build_dir' => __DIR__ . '/build/neos/%version%',
    'cache_dir' => __DIR__ . '/cache/neos/%version%',
    'default_opened_level' => 2,
    // use a custom theme directory
    'template_dirs'        => [__DIR__ . '/neos'],
    ]
);