8 – How do I register a custom labelCallbacks function for an existing entity?

I have learned that in EntityBase the label method is called to determine the name of an entity, for example, when rendered through the entity reference module as a label.

Now I want to change this name for certain node types. The module apparently calls a callback (old?):

  public function label() {
    $label = NULL;
    $entity_type = $this->getEntityType();
    if (($label_callback = $entity_type->getLabelCallback()) && is_callable($label_callback)) {
      $label = call_user_func($label_callback, $this);
    }
    elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) {
      $label = $this->{$label_key};
    }
    return $label;
  }

To register my own function for $entity_type->getLabelCallback()?

Active Directory with multi-factor authentication for an existing web application

The customer asks for LDAP / Active Directory authentication along with OTP (one-time password) / multi-factor authentication for an old existing web application written in (asp.net MVC2). Is that possible?

Currently we use PrincipalContext in System.DirectoryServices.AccountManagement for username and password verification.

This is an on-prem solution.

thank you in advance

html – Set up a flat file blog on an existing webstie

I would like to set up a simple flat file markdown blog for my website that I have created through installation lamp-server, My questions are:

  1. What do people recommend? Bludit, Grav, what else? I do not care about the design as long as I can maintain most of the CSS settings for the site (such as background color and font).
  2. Can people refer me to tutorials to set up anything they recommend for an existing website? Ideally, I would like to have a link on my homepage to the blog referring to www.gobs.eu/blog, and I would like to do so (if possible) without reinstalling / damaging things.

Any help would be appreciated!

Authentication – Use existing user accounts on an existing Web site

I have a website called satellite.com, which was created by AngularJS + NodeJS + MongoDB. It has an ID and password authentication system and third-party vendors such as Google and GitHub. It already has many user accounts.

Now I want to create a new website named umbrella.com, the authentication system and the database of ReactJS + NodeJS + MongoDB. Umbrella.com will include satellite.com features (which ideally share the code with satellite.com) and some other features. In the future, I want satellite.com and umbrella.com to exist and work (although satellite.com may systematically redirect to umbrella.com/satellite/).

I wonder how umbrella.com can use the existing satellite.com user accounts. Ideally, I hope

  1. Existing satellite.com users can log in to umbrella.com using their old credentials and have access to their satellite.com data
  2. New users can sign up for satellite.com, as do umbrella.com
  3. New users can sign up for umbrella.com, including satellite.com

I have complete control over the two websites. Does anyone have a clear idea of ​​how to structure and share the authentication system and database of these two websites?

Authentication – Use existing user accounts on an existing Web site

I have a website called satellite.com, which was created by AngularJS + NodeJS + MongoDB. It has an ID and password authentication system and third-party vendors such as Google and GitHub.
It already has many user accounts.

Now I want to create a new website named umbrella.com, the authentication system and the database of ReactJS + NodeJS + MongoDB. Umbrella.com will include satellite.com features (which ideally share the code with satellite.com) and some other features. In the future, I want both satellite.com and umbrella.com to exist and work.

I wonder how umbrella.com can use the existing satellite.com user accounts. Ideally, I hope

  1. Existing satellite.com users can log in to umbrella.com using their old credentials and have access to their satellite.com data
  2. New users can sign up for satellite.com, as do umbrella.com
  3. New users can sign up for umbrella.com, including satellite.com

I have complete control over the two websites. Does anyone have a clear idea of ​​how to structure and share the authentication system and database of these two websites?

p2p – Why do nodes not recover all existing outgoing connections when restarting?

According to the authors, the Erebus attack can be accelerated by restarting the node of the victim* in appropriate moments. This is because the node selects new outgoing peers from a list that has been compromised by the attack.

For what reason do nodes not frequently store their current outgoing peers on the hard drive and restore the connection upon reboot?

* A crash will harden the knots as much as possible

entity – Drupal 8.7 Change the field type for the custom entity (from integer to decimal) with existing data

Yes, I have seen previous answers, but I am looking for a new answer:

I do not know the Drupal 8 memory system well enough, so I'm looking for insights too.

I looked at a lot of documentation, including:

What caught my attention is this: "Starting with Drupal 8.7.0, the entity system provides a new update API for converting the schema of a content entity type from (not) revisable / (untranslatable) to auditable / translatable. This works even if there is already data for the entity type whose schema is being changed.. "

This was an indication of how to change a field type with existing data without having to write a lot of code.

So I've tried to change a field type of my custom entity that already contains data (~ 10000 lines).

function mymodule_post_update_0011_field_conversion(array $sandbox) {
    $definition_update_manager = Drupal::entityDefinitionUpdateManager();
    $last_installed_schema_repository = Drupal::service('entity.last_installed_schema.repository');

    $entity_type = $definition_update_manager->getEntityType('my_entity_id');
    $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions('my_entity_id');

    // Update field already existing in $field_storage_definitions
   // I also tried to create a new field, with the same outcome.
    $field_storage_definitions('order_vat') = BaseFieldDefinition::create('decimal')
      ->setLabel(t('Order VAT Rate'))
      ->setDescription(t('Order VAT Rate.'))
      ->setSettings(('precision' => 5, 'scale' => 2));

    Drupal::entityDefinitionUpdateManager()
      ->updateFieldableEntityType($entity_type, $field_storage_definitions,$sandbox);
  }

What ends with one DrupalCoreEntityEntityStorageException : Unsupported entity type

I tried using the same function to insert a new field into the entity, with the same error as the result.

Something is wrong with my attempt, and this can only be done manually in one post_update_hookto create a new field with the appropriate type, copy all values ​​from old to new, clear the old one and delete the old field?

This seems to be a lot of a simple operation that I could do in my case with a fairly simple SQL statement.

Last precision, this is a custom entity created from code only (ContentEntityBase), without revision (for now), which contents are manipulated only programmatically.

facebook – How can I migrate an existing page to the site page?

What is the right process to migrate an existing Facebook page (with likes, events, and posts) to a site page?

I have some brand pages (I'm an administrator of both) that say "My Brand" and "My Brand – Salt Lake". We have created pages and then added places in the name.

Now I want to make the other side, "My Brand – Salt Lake", the location of "My Brand" for this example. The problem with Facebook is that I can not claim it (under the Facebook Business Dashboard) "My Brand – Salt Lake" as a location because it does not have the same name as "My Brand", then Facebook apparently would not allow me to "Change My Brand – Salt Lake" to "My Brand" because the name already exists, so it's like a hen-egg problem.

What is the right way to do this?