Do not force specific folder structure for langcode and category

Created on 25 August 2023, over 1 year ago

Problem/Motivation

We are currently forcing a specific folder structure through the "getValueObjects()" method in ProjectWikiMarkdownContentPluginBase:

$langcode = explode(DIRECTORY_SEPARATOR, str_replace($searchDir . DIRECTORY_SEPARATOR, '', $file->uri), 2)[0];
$category = explode(DIRECTORY_SEPARATOR, explode(DIRECTORY_SEPARATOR, str_replace($searchDir . DIRECTORY_SEPARATOR, '', $file->uri), 2)[1], 2)[0];

This is very prone to errors and not very nice, since the user is allowed to define the starting directory through implementing "getEntriesDirectoryPath", but not the subdirectories. These HAVE to be named in the form of: [langcode]/[category]. This is an even bigger problem, since the implementation of 🐛 Use Drupal filter formats to filter the HTML and overhaul the markdown logic Fixed . Because we are actively using the langcode in code for "check_markup()" in
ProjectWikiMarkdownContentPluginBase now.

Steps to reproduce

Proposed resolution

Get the langcode and category through markdown metadata instead, with appropriate fallbacks.

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Grevil
  • Issue was unassigned.
  • 🇩🇪Germany Grevil

    Note, that the user can still decide to use the old folder structure, but nevertheless, we should use the file's metadata instead.

  • Assigned to lrwebks
  • 🇩🇪Germany lrwebks Porta Westfalica

    Assigning this task to me since I know how to implement this. The same mechanic is already in place for title and developerContent, just a simple if-case: If 'category'-Metadata is not defined, use folder instead!

  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Starting with this now! Should be simple enough...

  • @lrwebks opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇩🇪Germany lrwebks Porta Westfalica

    Done so far, implemented a check if the given attribute is defined as metadata, otherwise use the folders, and if that also fails use fallback values! Open for review now!

  • Issue was unassigned.
  • Status changed to Postponed over 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    I don't think this should have been implemented. If we get away from the straight and predefined structure, there's a high risk of confusion being added when searching for contents and I don't see a real benefit here. So I'm sure this isn't a good solution.

    Of course, we can discuss using a different folder / file name structure for translation, but using the meta header will result in documents being somewhere, where you don't expect them, especially with many contents in the folder structures.

    I'll postpone this for further discussion, but it would have been better to first discuss this, before investing time here.

  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇩🇪Germany Anybody Porta Westfalica

    PS: We can discuss merging this, but NOT using it in our projects. We should instead discuss the reasons for this change and if the folder & file name structure isn't perfect yet for reals world. But using this solution, the negative results are larger than the benefits.

  • 🇩🇪Germany Grevil

    @Anybody, this shouldn't be seen as an issue targeted at our use case, but rather for the general public. As I said, we can still use the folder structure in our project, but having langcode and category inside the metadata header and not forcing our strict folder structure on to other users, generally feels more flexible.

  • Status changed to Closed: won't fix 6 months ago
  • 🇩🇪Germany Grevil

    @anybody and I just had a look again, and we feel like the "strict" folder structure actually fits this module very well. We can dynamically set the starting directory (as already said), which is the main pain point users might address. And the strict need to provide a langcode / category actually helps to structure content.

    Let's close this as "won't fix".

Production build 0.71.5 2024