Switch Page Theme module allows to use different theme than the site default theme on specific pages. Module provides functionality to add multiple rules for different themes on specific set of pages for specific roles. This module also support Multi domain & Multilingual sites.

Configuration page path: /admin/config/system/switch_page_theme.

Clear cache to apply the changes.

Features

  • Multiple set of rules can be added.
  • Theme can be set for single page or list of pages.
  • Theme can be assigned to specific roles.
  • Wildcard '*' character can be used in drupal paths.
  • Supports Multi domain sites.
  • Supports Multilingual sites.

Project link:
https://www.drupal.org/project/switch_page_theme

Project Git url:
git clone --branch 8.x-3.x https://git.drupal.org/project/switch_page_theme.git

Manual reviews of other projects

https://www.drupal.org/node/2838541#comment-12048484
https://www.drupal.org/node/2844475#comment-12049191
https://www.drupal.org/node/2857851#comment-12049928

Comments

Deepali_agrwl created an issue. See original summary.

deepali_agarwal’s picture

Assigned: deepali_agarwal » Unassigned
deepali_agarwal’s picture

Issue summary: View changes
deepali_agarwal’s picture

Status: Active » Needs review
PA robot’s picture

Issue summary: View changes

Fixed the git clone URL in the issue summary for non-maintainer users.

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

deepali_agarwal’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
erik.erskine’s picture

Status: Needs review » Needs work

Manual review:

I get this error message when I first visit /admin/config/system/switch_page_theme after installing the module:

Warning: Invalid argument supplied for foreach() in Drupal\Core\Render\Element\Checkboxes::valueCallback() (line 100 of core/lib/Drupal/Core/Render/Element/Checkboxes.php).

I think that is because $config->get('roles') returns NULL before it has been set the first time. If you test for NULL, and set #default_value to be an empty array if so, you'll avoid this error.

A couple of other points regarding coding standards:

In PageThemeNegotiator, refer to interfaces instead of classes where possible, as described in the type hinting section here: https://www.drupal.org/docs/develop/coding-standards/object-oriented-code#hinting. In the constructor, rather than this:

public function __construct(ConfigFactoryInterface $config_factory, CurrentPathStack $currentPath, AliasManager $pathAlias, PathMatcher $pathMatcher, AccountProxy $account)

do this instead:

public function __construct(ConfigFactoryInterface $config_factory, CurrentPathStack $currentPath, AliasManagerInterface $pathAlias, PathMatcherInterface $pathMatcher, AccountProxyInterface $account)

Also, the local variables declared within the PageThemeNegotiator class should be declared with type hints:

/**
 * The proxy to the current user.
 *
 * @var \Drupal\Core\Session\AccountProxyInterface $account
 */
protected $account;
cchanana’s picture

Hello deepali_agarwal,

In info.yml file use package "User interface" instead of "Custom".

sushilpal’s picture

Hi deepali_agarwal,

Please see below couple points related to user experience which can be fixed .

1) when i go to config page first time and provide info and save. but in some case I do not remove config for pages and theme settings and also did not want to add for others so i am not be able to do because these fields are mandatory.

As i think these fields should not mandatory or you can put dependency validation like if page config has value then roles and themes must be mandatory.

2) You can make these 3 fields as a field set and gave add more options. in this case we can multiple theme for multiple page. this feature will make more powerful to this.

Thanks
S

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

deepali_agarwal’s picture

Status: Closed (won't fix) » Needs review

Fixed all the issues mentioned above.

Add more option is a new functionality which is added in future enhancements. Will release that feature ASAP.

Thanks

deepali_agarwal’s picture

Functionality to add multiple rules for different themes on specific set of pages for specific roles is added in latest branch.

deepali_agarwal’s picture

Issue summary: View changes

Added support for Multi domain & Multilingual sites.

deepali_agarwal’s picture

Issue summary: View changes
RumyanaRuseva’s picture

Status: Needs review » Reviewed & tested by the community

Manual review:

Latest release of the module seems to work ok, all errors have been fixed. Code is clean and it follows Drupal standards.
The configuration is simple and intuitive, the module does exactly what it's supposed to do.

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for your contribution, deepali_agarwal!

I updated your account so you can opt into security advisory coverage now.

I did not find any security issues in your project. My only comment would be that you can simplify some of the boolean logic in PageThemeNegotiator::applies() you have several lines like:

if (a && b) {
  $condition = TRUE;
}
else {
  $condition = FALSE;
}

can be replaced with:

$condition = (a && b);

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.