Comments

LewisNyman created an issue. See original summary.

LewisNyman’s picture

Issue summary: View changes
LewisNyman’s picture

Issue summary: View changes
LewisNyman’s picture

Issue summary: View changes
cilefen’s picture

Vehicle Voltron or Lion Voltron? It matters.

RainbowArray’s picture

For the front-end UI things, we should make sure we do the funky magic that lets those work on the frontend no matter the theme. This was the example you had mentioned LewisNyman.

<?php
/**
 * Implements hook_library_info_alter().
 *
 * Includes additional stylesheets defined by the admin theme to allow it to
 * customize the Node Preview bar appearance.
 *
 * An admin theme can specify CSS files to make the node preview bar match the
 * administration experience in the back-end.
 *
 * The CSS files can be specified via the "node_preview_stylesheets" property
 * in the .info.yml file:
 * @code
 * preview_stylesheets:
 *   - css/node-preview.css
 * @endcode
 */
function node_library_info_alter(&$libraries, $extension) {
  if ($extension === 'node' && isset($libraries['drupal.node.preview'])) {
    $theme = Drupal::config('system.theme')->get('admin');
    
// First let the base theme modify the library, then the actual theme.
    $alter_library = function(&$library, $theme) use (&$alter_library) {
      if (isset($theme) && $theme_path = drupal_get_path('theme', $theme)) {
        $info = system_get_info('theme', $theme);
        // Recurse to process base theme(s) first.
        if (isset($info['base theme'])) {
          $alter_library($library, $info['base theme']);
        }
        if (isset($info['node_preview_stylesheets'])) {
          foreach ($info['node_preview_stylesheets'] as $path) {
            // Ensure it overrides any styling from the frontend theme.
            $library['css']['theme']['/' . $theme_path . '/' . $path] = ['weight' => 20 ];
          }
        }
      }
    };
    
$alter_library($libraries['drupal.node.preview'], $theme);
  }
}
?>
gints.erglis’s picture

Issue summary: View changes
lauriii’s picture

I understand the positive things that this could give us. How much I would like to see this happen, I just feel like with the given time we it might be a bad idea to make it happen since I don't believe we could make it good enough. People writing their own admin themes (which is small number of people) would benefit out of this most because they can control the supported modules and frontend themes quite easily but giving that responsibility for contrib project seems really tough with the given artifacts. It would be also nice to find a solution that works everywhere the same way, not that every module implements its own way of managing this.

What happens if markup is modified for some reason in the frontend theme? Also in addition for the CSS and JS admin theme should be able to modify the markup, like the other systems implementing this kind of pattern. Now there is too many things to break your stuff. Someone might say there is already ways to break stuff - yes, there is but its somehow predictable and its happening in a sandbox - in the current theme tree. By making this change we would make frontend themes suffer one more unknown; how does admin theme modify my CSS and JS, what markup is required by it to work properly. TBH I believe some theme wouldn't be compatible with each other at all so there should be some way to define which projects are supported and which not to ensure high quality for users.

And how are we supporting contrib module projects by doing that? Lets say I create my own fancy admin menu module and there is multiple different designs for that, how am I supposed to be providing those with the new ideology? By creating multiple admin themes providing the styles or creating new modules for that? Also not many of the admin themes would be theming my contrib, so am I supposed to be able to find admin themes supporting that contrib? What if I use multiple modules and I cant find admin theme supporting them all and they are not compatible with each other?

I don't feel like all the possible use cases how frontend themes can be used has been seriously considered while making these decisions. I also don't think doing this last minute before RC1 is good idea because we cannot get feedback from the theme developers.

I'm really sorry to be against this and also raising my concerns here especially considering all the good things it could bring for us, but I don't feel confident for staying silent.

LewisNyman’s picture

I'm really sorry to be against this and also raising my concerns here especially considering all the good things it could bring for us, but I don't feel confident for staying silent.

Raising concerns are great, I'm happy to talk with you about them. The problem we have now is raising them in the issue queue the day before RC. I have to choose between spending my time today addressing these concerns/questions or working on issues that need to be committed today. This feels like strategic blocking of the issue and burnout of the people involved in these issues. I know you pretty well by now Lauri and I don't think this is your intent here.

What happens if markup is modified for some reason in the frontend theme?

We've had this discussion open for a year and a half in #2195695: Admin UIs on the front-end are difficult to theme. The only viable solution we have available today is the current one. Yes frontend themes can still shoot themselves in the foot, but this is giving them one less barrel to do so. There is no desire from theme developers to support Drupal's admin functionality in every custom theme they build. Only taking the CSS out of their hands is not as good as taking the markup out of their hands as well, but we can't achieve that without rethinking how we architect the theme system.

If frontend themes do really have a desire to influence the look and feel of these components, they can easily do this with a library override, that doesn't change.

And how are we supporting contrib module projects by doing that?

We don't, see the discussion in #2195695: Admin UIs on the front-end are difficult to theme and the comment #13 in particular. In the future admin themes will support a finite number of reusable UI components, and modules would choose the components they want to use the styling from. We can't implement this until we have a real component-based theme system.

Bojhan’s picture

@laurri You worked on a strategy for addressing this, could you provide an update on this?

RainbowArray’s picture

andypost’s picture

Version: 8.0.x-dev » 8.1.x-dev

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.