1

My goal is to override the function isApprovalRequired() in a Trait for the module Social Auth (social_auth). The file:

modules/contrib/social_auth/src/SettingsTrait.php 

has a function (along with variables and other functions):

namespace Drupal\social_auth;

use Drupal\Core\Url;
use Drupal\user\UserInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
* Helper methods for Social Auth and Drupal settings.
*/
trait SettingsTrait {
  ...
  protected $configFactory;
  ...
  protected function isApprovalRequired() { 

that I would like to overwrite. How do I overwrite JUST that one function in my own module? I've done similar things with classes before, but not sure what to do with a Trait.

1

1 Answer 1

0

For those that may run across this. I could not find a way to override (don't think it's possible). I did eventually settle on modifying the line of the file myself, running a git diff, and adding my own patch to my composer.json. In this way, I can run updates and use composer correctly. It's not a patch others will need, but how it was solved might help others.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.