This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

What to use to include content in GIT versioning?

I have read through the following options I found. I am not sure which one to choose, when it comes to suitability for initial import, update convenience, future module support etc. Can you please share your experience to help me make my choice:

What to use instead of a global const in procedural code?

I have something like the following in mymodule.module:

const MYMODULE_CONST = 42;

/**
 * Implements hook_myhook().
 */
function mymodule_myhook($route_name, RouteMatchInterface $route_match) {
  return(t('The answer is @const', ['@const' => MYMODULE_CONST]));
}

This is the only place I use this constant. The reason for using a PHP global const for this is to have it defined near the top of the file for easy spotting and replacement. So having it as a value inside the function is not an option.

7.72 Upgrade Caused Problem With Form #STATES.

All,

Summary: In 7.72, AJAX Callbacks affect "AND" conditional of FAPI fields that use #STATES

Routing issue

Hello there! I am trying to get used to the new way drupal 8/9 does things (I am an avid d7 developer), but having trouble finding proper documentation. 

So I am building an invoicing system for a client, and I have two routes setup in my invoicing.routing.yml file, as shown below

Using hook_entity_view_alter(), want to change the filed's title(label) with certain display_id

I've been trying to display netId through the display on the view.

So, I used hook_entity_view_alter to alter the title of the field and the field_content to be the netId.

But it doesn't seem to be working.
So, my question is 

1) Is $display->id() a machine_name of the display?

2) Is there any better way to go about?

function directories_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {

  if ($display->id() != 'team_directory') {

    return;

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions