- Issue created by @joelpittet
- šØš¦Canada joelpittet Vancouver
I'm narrowing down on š Making a theme compatible with core's theme generator is too difficult Needs work
Where this code was introduced in
GenerateTheme
:private static function namePatterns(string $machine_name, string $label): array { return [ 'machine_name' => $machine_name, 'machine_name_camel' => u($machine_name)->camel(), 'machine_name_pascal' => u($machine_name)->camel()->title(), 'machine_name_title' => u($machine_name)->title(), 'label' => $label, 'label_camel' => u($label)->camel(), 'label_pascal' => u($label)->camel()->title(), 'label_title' => u($label)->title(), ]; }
- šØš¦Canada joelpittet Vancouver
Breaking that out with the Issue Summary example:
$patterns = [ 'old' => [ 'machine_name' => 'galactus', 'machine_name_camel' => 'galactus', 'machine_name_pascal' => 'Galactus', 'machine_name_title' => 'Galactus', 'label' => 'Galactus', 'label_camel' => 'galactus', 'label_pascal' => 'Galactus', 'label_title' => 'Galactus', ], 'new' => [ 'machine_name' => 'galactus_ta', 'machine_name_camel' => 'galactusTa', 'machine_name_pascal' => 'GalactusTa', 'machine_name_title' => 'Galactus_ta', 'label' => 'galactus_ta', 'label_camel' => 'galactusTa', 'label_pascal' => 'GalactusTa', 'label_title' => 'Galactus_ta', ], ]; $filename = str_replace($patterns['old'], $patterns['new'], $old_filename); Why does it always add TaTa_ to the new $filename in these examples $old_filename = 'galactus.settings.yml' $filename = 'galactusTaTa_ta.settings.yml' $old_filename = 'block.block.galactus_mainpagecontent.yml' $filename = 'block.block.galactusTaTa_ta_mainpagecontent.yml' $old_filename = 'block.block.galactus_pagetitle.yml' $filename = 'block.block.galactusTaTa_ta_pagetitle.yml' $old_filename = 'block.block.galactus_tabs.yml' $filename = 'block.block.galactusTaTa_ta_tabs.yml' $old_filename = 'block.block.galactus_primaryadminactions.yml' $filename = 'block.block.galactusTaTa_ta_primaryadminactions.yml' $old_filename = 'block.block.galactus_main_menu.yml' $filename = 'block.block.galactusTaTa_ta_main_menu.yml' $old_filename = 'block.block.galactus_breadcrumbs.yml' $filename = 'block.block.galactusTaTa_ta_breadcrumbs.yml' $old_filename = 'block.block.galactus_help.yml' $filename = 'block.block.galactusTaTa_ta_help.yml' $old_filename = 'block.block.galactus_drawer.yml' $filename = 'block.block.galactusTaTa_ta_drawer.yml' $old_filename = 'galactus.schema.yml' $filename = 'galactusTaTa_ta.schema.yml' $old_filename = 'galactus.theme' $filename = 'galactusTaTa_ta.theme' $old_filename = 'galactus.libraries.yml' $filename = 'galactusTaTa_ta.libraries.yml' $old_filename = 'galactus.breakpoints.yml' $filename = 'galactusTaTa_ta.breakpoints.yml' $old_filename = 'galactus.info.yml' $filename = 'galactusTaTa_ta.info.yml'
It applies to more than just files, it's only that this is easy to represent.
Still working on a solution but it would be nice to know why so many variations for the replacements were needed in the first place.
- Status changed to Needs review
9 months ago 4:32am 14 September 2024 - šØš¦Canada joelpittet Vancouver
This affects themes like https://www.drupal.org/project/basic ā which I would like to be a starterkit theme.
- Status changed to Needs work
9 months ago 1:19pm 16 September 2024 - šŗšøUnited States smustgrave
Seems to have an error.
Could issue summary also be filled out please
Thanks.
- Status changed to Needs review
9 months ago 11:45pm 16 September 2024 - šØš¦Canada joelpittet Vancouver
@smustgrave, I don't have a fix but the tests do demo the problem.
Updated the issue summary to help make this clearer
- Status changed to Needs work
9 months ago 3:55pm 19 September 2024 - šŗšøUnited States smustgrave
Awesome to already have test coverage. But moving to NW for the solution. Not sure it's likely to get picked up for development in review queue.
- šŗšøUnited States mortona2k Seattle
Does this consider themes with SDC? Templates that reference components as THEME:COMPONENT need the theme part updated.
- First commit to issue fork.
- šØš¦Canada garphy Montreal, Canada
@joelpittet I pushed a little update to perform the two str_replace in file contents in one go, avoiding the intermediate content write to the file.
- šØš¦Canada joelpittet Vancouver
Thanks @garphy for taking a crack at it. I dropped it because my brain needed a break... I felt close but for some reason no dice! Thanks for the test alterations as well!
- šØš¦Canada joelpittet Vancouver
@mortona2k RE #9 I don't think I was thinking about that in this problem. But if it doesn't work now, it likely won't be fixed here...
Feel free to add tests if you care to see if it has affects on it but try to avoid scope creeping this, please