You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 7, 2021. It is now read-only.
The given wiki example for modifying objects used by LmcUser is not working anymore. With the current implementation of the Service Manager, the Laminas Framework offers a much more elegant way to modify the objects. The given example should be updated using Delegators instead of the onBootstrap method.
The following example adds placeholder attributes to the identity and credential form elements in the login form.
<?php
declare(strict_types=1);
namespace Application\ServiceManager\Factory;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\DelegatorFactoryInterface;
class LoginFormDelegatorFactory implements DelegatorFactoryInterface
{
public function __invoke(ContainerInterface $container, $name, callable $callback, array $options = null)
{
$form = call_user_func($callback);
$form->get('identity')->setAttribute('placeholder', 'username');
$form->get('credential')->setAttribute('placeholder', 'password');
return $form;
}
}
You have to register this delegator in your service manager configuration in the module.config.php file of your custom module, that implements the LmcUser module.
The aliases for the delegator array entry can be taken from the Module.php file of the LmcUser module. The Module.php contains the service manager configuration inside the getServiceConfig() method. All used aliases are listed there.
The given wiki example for modifying objects used by LmcUser is not working anymore. With the current implementation of the Service Manager, the Laminas Framework offers a much more elegant way to modify the objects. The given example should be updated using Delegators instead of the
onBootstrapmethod.The following example adds placeholder attributes to the
identityandcredentialform elements in the login form.You have to register this delegator in your service manager configuration in the
module.config.phpfile of your custom module, that implements theLmcUsermodule.The aliases for the delegator array entry can be taken from the
Module.phpfile of theLmcUsermodule. TheModule.phpcontains the service manager configuration inside thegetServiceConfig()method. All used aliases are listed there.