You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem you would like to solve
The Theme Options API allows a theme to add custom fields that are only supported by that theme. At the same time, the core applications (OJS/OMP/OPS) have several settings under Settings > Website > Appearance which every theme must support. For example, the "Logo", "Homepage Image", "Page Footer", "Sidebar" and "Additional Content" settings may be implemented or not in each theme. Regardless of whether these settings are used by the theme, they always appear in the settings area.
Describe the solution you have in mind
Adopt a technique to allow a theme to declare support for one or more core options, similar to WordPress's add_theme_support. To ensure good type hinting and code completion, I'd suggest a method for each support, such as:
class Theme extends Plugin
{
protected ?bool $supportsHomepageImage = null;
public function setHomepageImageSupport(?bool $supported): self
{
$this->supportsHomepageImage = $supported;
return $this;
}
}
A theme would register it's support for a feature in the init() method:
class DefaultThemePlugin extends \PKP\plugins\ThemePlugin
{
publicfunctioninit()
{
$this->setHomepageImageSupport(true);
}
}
Who is requesting this change?
As part of sponsored development work for a custom theme, I am implementing a "features" slider. Journals can set up slides to feature items and the custom theme will show them in a slider. The default theme will be modified to support this, but not all of PKP's themes will be modified.
Using a method like ThemePlugin::setFeaturesSupport() would mean that journals running a theme which don't opt into this feature won't see the features area in the editorial backend.
Additional Details @asmecher and @jardakotesovec I'm happy to implement this whichever way you want. If you're not thrilled about the supportsABC() method, I can just put it behind a feature flag for 3.4.0.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Describe the problem you would like to solve
The Theme Options API allows a theme to add custom fields that are only supported by that theme. At the same time, the core applications (OJS/OMP/OPS) have several settings under Settings > Website > Appearance which every theme must support. For example, the "Logo", "Homepage Image", "Page Footer", "Sidebar" and "Additional Content" settings may be implemented or not in each theme. Regardless of whether these settings are used by the theme, they always appear in the settings area.
Describe the solution you have in mind
Adopt a technique to allow a theme to declare support for one or more core options, similar to WordPress's add_theme_support. To ensure good type hinting and code completion, I'd suggest a method for each support, such as:
A theme would register it's support for a feature in the
init()
method:Who is requesting this change?
As part of sponsored development work for a custom theme, I am implementing a "features" slider. Journals can set up slides to feature items and the custom theme will show them in a slider. The default theme will be modified to support this, but not all of PKP's themes will be modified.
Using a method like
ThemePlugin::setFeaturesSupport()
would mean that journals running a theme which don't opt into this feature won't see the features area in the editorial backend.Additional Details
@asmecher and @jardakotesovec I'm happy to implement this whichever way you want. If you're not thrilled about the
supportsABC()
method, I can just put it behind a feature flag for 3.4.0.Beta Was this translation helpful? Give feedback.
All reactions