Problem/Motivation

Each extra field component ID from this module is prefixed by:
extra_field_

It would be nice and best practice to put this prefix into a constant for easier reuse. For example in extra_field_plus we need the same variable and it's uncool to hardcode it.

Currently can be found in: web/modules/contrib/extra_field/src/Plugin/ExtraFieldManagerBase.php

  /**
   * Build the field name string.
   *
   * @param string $pluginId
   *   The machine name of the Extra Field plugin.
   *
   * @return string
   *   Field name.
   */
  protected function fieldName($pluginId) {

    return 'extra_field_' . $pluginId;
  }

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Anybody created an issue. See original summary.

anybody’s picture

Title: Make extra_field_ prefix a constant for reuse » 3305672-make-extrafield-prefix-constant
Status: Active » Needs review

See the MR for an example. This is not finished. As the same prefix is used at several places, I wasn't sure in which class to put the constant. Or should it be global in the module file? Unsure...

See https://git.drupalcode.org/search?search=extra_field_&nav_source=navbar&...

anybody’s picture

Title: 3305672-make-extrafield-prefix-constant » Make extra_field_ prefix a constant for reuse

lol, what happened here... sorry ;) Restoring title.

anybody’s picture

The test error is unrelated to this issue.

Sutharsan made their first commit to this issue’s fork.

  • Sutharsan committed b950117 on 8.x-2.x authored by Anybody
    git commit -m 'Issue #3305672 by Anybody, Sutharsan: Make extra_field_...
sutharsan’s picture

Status: Needs review » Fixed
anybody’s picture

Thank you, @Sutharsan :)

I'll now add the same to extra_field_plus! :) BTW would you like to become Co-Maintainer there? Are you using extra_field_plus?

sutharsan’s picture

No, thank you. I’m not using that module.

Status: Fixed » Closed (fixed)

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