This module provides developer-configurable labels that can be printed in any twig template. Admin users can edit the text that will be output wherever the label appears without having advanced permissions like 'administer themes'.

We often find ourselves providing custom blocks or theme settings in order to allow site editors and administrators a simple way to edit text on sites. In some cases, this is a great solution. In other cases, it is overkill when a simple, editable text-label would suffice.

This functionality is similar to using tokens, except these labels are intended specifically to be used in twig templates as simple text labels where tokens are not.

Project Page: https://www.drupal.org/sandbox/gradywring/2796663

git clone --branch 8.x-1.x https://git.drupal.org/sandbox/gradywring/2796663.git

Comments

gradywring created an issue. See original summary.

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.

Graber’s picture

Status: Needs review » Needs work

Hi there,

Reviewed your module, my general remark is that such data is usually bound to a specific theme and therefore such labels should reside in theme settings (with each variable name hardcoded) not in a module, defining labels like this can lead to unexpected errors caused with code-config inconsistencies.

Template results below:

Automated Review

No automated test cases were found.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch. just add the module folder name at the end of git clone link.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
List of identified issues in no particular order. Use (*) and (+) to indicate an issue importance. Replace the text below by the issues themselves:
  1. * May cause performance issues as it injects variables to every template. labels_preprocess function should have a static storage.
  2. * Due to the above I'd add a setting to enter theme names to preprocess instead of preprocessing everything.
  3. Found a few coding standards complience issues

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

gradywring’s picture

Hey, thanks for the review. Great recommendations. I will make those changes right away.

Did you use a tool to find the standards compliance issues? If so, which one?

Graber’s picture

You're welcome :)

I use phpcs with latest coder standards (https://www.drupal.org/project/coder). Not much of it really (mainly variable naming conventions), I don't think anyone will block a project because of that..

gradywring’s picture

Cool, thanks. I'm going to add some configuration for each label to limit each label's scope to specific themes and hooks. Your note about this type of thing typically being a theme setting was not ignored and I completely agree. The main reason for this approach is to be able to give lower-level site editors access to these string labels without full-blown 'administer themes' permission.

gradywring’s picture

Status: Needs work » Needs review

Fixed all issues and recommendations:

  1. Added static storage for variables in labels_preprocess so that the database/config is called less often.
  2. Added required fields for Themes and Hooks so that each label can be limited in scope for specific themes and theme hooks.

I also added the ability to edit labels from the admin.

gradywring’s picture

Issue summary: View changes
gradywring’s picture

Bumping because it has been a month since setting to Needs Review.

meickol’s picture

Hi @gradywring,

Recommendations:

please check the git clone url, should be something like :

git clone --branch 8.x-1.x https://git.drupal.org/sandbox/user_name/2686393.git module_name_folder
cd module_name_folder 

Automated Review

And check this pareview please, you have some stuffs to fix and add that link to your project applications helps.
https://pareview.sh/node/1287

Manual Review

Everything else look good for me.

please help me reviewing my project applications, thanks.
https://www.drupal.org/node/2849311

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpsgitdrupalorgsandboxgradywring2796663git

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

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.