Skip to content

Commit

Permalink
Fix Merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 committed Mar 24, 2023
1 parent b085b0a commit 683bbf8
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 211 deletions.
58 changes: 31 additions & 27 deletions bundles/AdminBundle/Event/AdminEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,6 @@ class AdminEvents
*/
const LOGIN_REDIRECT = 'pimcore.admin.login.redirect';

/**
* The LOGIN_CREDENTIALS event is triggered after login credentials were resolved from request.
*
* This event allows you to influence the credentials resolved in the authenticator before
* they are passed to getUser().
*
* @Event("Pimcore\Event\Admin\Login\LoginCredentialsEvent")
*
* @var string
*/
const LOGIN_CREDENTIALS = 'pimcore.admin.login.credentials';

/**
* The LOGIN_FAILED event is triggered when credentials were invalid.
*
* This event allows you to set a custom user which is resolved from the given credentials
* from a third-party authentication system (e.g. an external service).
*
* @Event("Pimcore\Event\Admin\Login\LoginFailedEvent")
*
* @var string
*/
const LOGIN_FAILED = 'pimcore.admin.login.failed';

/**
* The LOGIN_LOSTPASSWORD event is triggered before the lost password email
* is sent.
Expand All @@ -78,6 +54,25 @@ class AdminEvents
*/
const LOGIN_LOGOUT = 'pimcore.admin.login.logout';

/**
* The LOGIN_BEFORE_RENDER event is triggered before the login view is rendered.
*
* Allows overriding the parameters and including templates.
* ```php
* public function getContent(GenericEvent $event): void
* {
* $parameters = $event->getArgument('parameters');
* $parameters['includeTemplates']['VendorBundleName'] = '@VendorBundleName/path/to/template.html.twig';
* $event->setArgument('parameters', $parameters);
* }
* ```
*
* @Event("Symfony\Component\EventDispatcher\GenericEvent")
*
* @var string
*/
const LOGIN_BEFORE_RENDER = 'pimcore.admin.login.beforeRender';

/**
* The INDEX_SETTINGS event is triggered when the settings object is built for the index page.
*
Expand All @@ -87,6 +82,15 @@ class AdminEvents
*/
const INDEX_ACTION_SETTINGS = 'pimcore.admin.indexAction.settings';

/**
* The SAVE_SYSTEM_SETTINGS event is triggered when the system settings are saved.
*
* @Event("Symfony\Component\EventDispatcher\GenericEvent")
*
* @var string
*/
const SAVE_ACTION_SYSTEM_SETTINGS = 'pimcore.admin.saveAction.system.settings';

/**
* Fired before the request params are parsed.
*
Expand Down Expand Up @@ -344,7 +348,7 @@ class AdminEvents
*
* @var string
*/
const ASSET_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.asset.treeGetChildsById.preSendData';
const ASSET_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.asset.treeGetChildrenById.preSendData';

/**
* Fired before the request params are parsed.
Expand All @@ -369,7 +373,7 @@ class AdminEvents
*
* @var string
*/
const DOCUMENT_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.document.treeGetChildsById.preSendData';
const DOCUMENT_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.document.treeGetChildrenById.preSendData';

/**
* Fired before the request params are parsed.
Expand Down Expand Up @@ -408,7 +412,7 @@ class AdminEvents
*
* @var string
*/
const OBJECT_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.dataobject.treeGetChildsById.preSendData';
const OBJECT_TREE_GET_CHILDREN_BY_ID_PRE_SEND_DATA = 'pimcore.admin.dataobject.treeGetChildrenById.preSendData';

/**
* Subject: \Pimcore\Bundle\AdminBundle\Controller\Admin\ClassController
Expand Down
38 changes: 7 additions & 31 deletions bundles/AdminBundle/Event/ElementAdminStyleEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,62 +38,41 @@ class ElementAdminStyleEvent extends Event
*/
const CONTEXT_SEARCH = 3;

/**
* @var int
*/
protected $context;
protected ?int $context = null;

/**
* @var ElementInterface
*/
protected $element;
protected ElementInterface $element;

/**
* @var AdminStyle
*/
protected $adminStyle;
protected AdminStyle $adminStyle;

/**
* ElementAdminStyleEvent constructor.
*
* @param ElementInterface $element
* @param AdminStyle $adminStyle
* @param null|int $context
* @param int|null $context
*/
public function __construct(ElementInterface $element, AdminStyle $adminStyle, $context = null)
public function __construct(ElementInterface $element, AdminStyle $adminStyle, int $context = null)
{
$this->element = $element;
$this->adminStyle = $adminStyle;
$this->context = $context;
}

/**
* @return ElementInterface
*/
public function getElement(): ElementInterface
{
return $this->element;
}

/**
* @param ElementInterface $element
*/
public function setElement(ElementInterface $element): void
{
$this->element = $element;
}

/**
* @return AdminStyle
*/
public function getAdminStyle(): AdminStyle
{
return $this->adminStyle;
}

/**
* @param AdminStyle $adminStyle
*/
public function setAdminStyle(AdminStyle $adminStyle): void
{
$this->adminStyle = $adminStyle;
Expand All @@ -104,15 +83,12 @@ public function setAdminStyle(AdminStyle $adminStyle): void
*
* @return null|int
*/
public function getContext()
public function getContext(): ?int
{
return $this->context;
}

/**
* @param null|int $context
*/
public function setContext($context): void
public function setContext(?int $context): void
{
$this->context = $context;
}
Expand Down
13 changes: 3 additions & 10 deletions bundles/AdminBundle/Event/IndexActionSettingsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@

class IndexActionSettingsEvent extends Event
{
/**
* @var array
*/
private $settings;
private array $settings;

public function __construct(array $settings)
{
Expand All @@ -36,16 +33,12 @@ public function getSettings(): array
return $this->settings;
}

public function setSettings(array $settings)
public function setSettings(array $settings): void
{
$this->settings = $settings;
}

/**
* @param string $key
* @param mixed $value
*/
public function addSetting(string $key, $value)
public function addSetting(string $key, mixed $value): void
{
$this->settings[$key] = $value;
}
Expand Down
21 changes: 4 additions & 17 deletions bundles/AdminBundle/Event/Login/LoginCredentialsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,20 @@ class LoginCredentialsEvent extends Event
{
use RequestAwareTrait;

/**
* @var array
*/
protected $credentials;

/**
* @param Request $request
* @param array $credentials
*/
protected array $credentials;

public function __construct(Request $request, array $credentials)
{
$this->request = $request;
$this->credentials = $credentials;
}

/**
* @return array
*/
public function getCredentials()
public function getCredentials(): array
{
return $this->credentials;
}

/**
* @param array $credentials
*/
public function setCredentials(array $credentials)
public function setCredentials(array $credentials): void
{
$this->credentials = $credentials;
}
Expand Down
34 changes: 7 additions & 27 deletions bundles/AdminBundle/Event/Login/LoginFailedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,16 @@

class LoginFailedEvent extends Event
{
/**
* @var array
*/
protected $credentials;
protected array $credentials;

/**
* @var User
*/
protected $user;
protected ?User $user = null;

/**
* @param array $credentials
*/
public function __construct(array $credentials)
{
$this->credentials = $credentials;
}

/**
* @return array
*/
public function getCredentials()
public function getCredentials(): array
{
return $this->credentials;
}
Expand All @@ -52,7 +40,7 @@ public function getCredentials()
*
* @return mixed
*/
public function getCredential($name, $default = null)
public function getCredential(string $name, mixed $default = null): mixed
{
if (isset($this->credentials[$name])) {
return $this->credentials[$name];
Expand All @@ -61,30 +49,22 @@ public function getCredential($name, $default = null)
return $default;
}

/**
* @return User
*/
public function getUser()
public function getUser(): ?User
{
return $this->user;
}

/**
* @param User $user
*
* @return $this
*/
public function setUser(User $user)
public function setUser(User $user): static
{
$this->user = $user;

return $this;
}

/**
* @return bool
*/
public function hasUser()
public function hasUser(): bool
{
return null !== $this->user;
}
Expand Down
26 changes: 2 additions & 24 deletions bundles/AdminBundle/Event/Login/LoginRedirectEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,31 @@

class LoginRedirectEvent extends Event
{
/**
* @var string
*/
protected $routeName;
protected string $routeName;

/**
* @var array
*/
protected $routeParams;
protected array $routeParams;

/**
* @param string $routeName
* @param array $routeParams
*/
public function __construct(string $routeName, array $routeParams = [])
{
$this->routeName = $routeName;
$this->routeParams = $routeParams;
}

/**
* @return string
*/
public function getRouteName(): string
{
return $this->routeName;
}

/**
* @param string $routeName
*/
public function setRouteName(string $routeName): void
{
$this->routeName = $routeName;
}

/**
* @return array
*/
public function getRouteParams(): array
{
return $this->routeParams;
}

/**
* @param array $routeParams
*/
public function setRouteParams(array $routeParams): void
{
$this->routeParams = $routeParams;
Expand Down
Loading

0 comments on commit 683bbf8

Please sign in to comment.