Problem/Motivation

Currently working on themes is not perfect. The theme information is cached so hard, that you cannot just add a new library.

Proposed resolution

Ensure that not only the theme registry but also the information coming from .info.yml is rebuild

Remaining tasks

User interface changes

API changes

CommentFileSizeAuthor
#1 theme_rebuild-2330743-1.patch4.41 KBdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
4.41 KB

Here is a version which works, but has a workaround for a core bug.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine. Does Drush need changes to `drush cc theme-registry`?

+ /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
+ $theme_handler = \Drupal::service('theme_handler');

Has there been discussion of Drupal implementing type hinting as per http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata?

dawehner’s picture

@moshe weitzman
In case you consider the information in the .info.yml file as important as well, yes.

No idea regarding your question.

moshe weitzman’s picture

Save the code below to /.phpstorm.meta.php and then you autocomplete for the theme_handler service *everywhere*. No more type hinting each call. Here are the PHPstorm docs for this. I'm using PHPStorm7.

I really think Drupal or Drush should have a script for generating this file for all services and other factory stuff.

<?php
namespace PHPSTORM_META {                                                 // we want to avoid the pollution

  /** @noinspection PhpUnusedLocalVariableInspection */                 // just to have a green code below
  /** @noinspection PhpIllegalArrayKeyTypeInspection */
  $STATIC_METHOD_TYPES = [                                              // we make sections for scopes
    \Drupal::service('') => array(
      'theme_handler' instanceof \Drupal\Core\Extension\ThemeHandlerInterface,
    ),
  ];
}
dawehner’s picture

The actual reason is not just typehinting in the idea. It is about actually making the source code easier to read, as you don't have
to figure out what kind of class this is, especially helpful in NON-IDE environments.

Hydra’s picture

Working for me, +1 for RTBC, this is really annoying while theme development...

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

Fixed thx.

Created https://github.com/drush-ops/drush/issues/805 to handle `drush cc theme`

Status: Fixed » Closed (fixed)

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