diff options
Diffstat (limited to 'themes/_custom/theme.php')
| -rw-r--r-- | themes/_custom/theme.php | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/themes/_custom/theme.php b/themes/_custom/theme.php index aa85871f45..8cf6f03672 100644 --- a/themes/_custom/theme.php +++ b/themes/_custom/theme.php @@ -19,37 +19,22 @@ use Fisharebest\Webtrees\Menu; use Fisharebest\Webtrees\Theme\WebtreesTheme; /** - * Class CustomTheme - This is a template showing how to create a custom theme. + * Class MyTheme - This is a template showing how to create a custom theme. * * Since theme folders beginning with an underscore are reserved for special * use, you should copy this entire folder ("themes/_custom") to a new name. - * For example, "themes/custom". You should also rename the class. + * For example, "themes/mytheme". You should also rename the class. * * In this example, we are extending the webtrees theme, but you could * also extend any of the core themes, or even the base theme. - * - * Only the first two functions are required: themeId() and themeName(). - * The rest are just examples, and should be removed in actual themes. */ class MyTheme extends WebtreesTheme { - /** - * Give your theme a unique identifier. Themes beginning with an underscore - * are reserved for internal use. - * - * {@inheritdoc} - */ - public function themeId() { - return '_custom'; - } + // The ID (and folder) for your theme. + const THEME_DIR = '_custom'; /** * Give your theme a name. This is shown to the users. * Use HTML entities where appropriate. e.g. “Black & white”. - * - * You could use switch($this->locale) {} to provide a translated versions - * of the theme name. - * - * {@inheritdoc} */ public function themeName() { return 'Custom theme'; @@ -58,14 +43,13 @@ class MyTheme extends WebtreesTheme { /** * This is an example function which shows how to add an additional CSS file to the theme. * - * {@inheritdoc} + * @return string[] */ - public function stylesheets() { - $css_files = parent::stylesheets(); - // Put a version number in the URL, to prevent browsers from caching old versions. - $css_files[] = WT_BASE_URL . 'themes/_custom/custom-v1.0.css'; - - return $css_files; + protected function stylesheets() { + return array_merge(parent::stylesheets(), [ + // Put a version number in the URL, for efficient browser caching. + WT_BASE_URL . 'themes/' . self::THEME_DIR . '/css-1.0.0/style.css', + ]); } /** |
