Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add url inActionDto::getAsConfigObject #5006

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

jorissae
Copy link
Contributor

@jorissae jorissae commented Jan 27, 2022

If I have an crud controller A with

public function configureActions(Actions $actions): Actions
    {
        return $actions
            ->update(Crud::PAGE_INDEX, Action::NEW, function (Action $action) {
                return $action->linkToUrl(function () use ($action) {
                    return $this->generateAdminUrl(Crud::PAGE_NEW); //generate url and add params
                });
            })
    }

And I have an crud controller B who extend A with

public function configureActions(Actions $actions): Actions
{
        $actions = parent::configureActions($actions);
         return $actions
            ->update(Crud::PAGE_INDEX, Action::NEW, function (Action $action) {
                return $action->addCssClass('action-new btn btn-secondary');
            })
}

The parameters are lost because the url is in ActionDto while the update function transforms ActionDto into ActionConfig and then transforms ActionConfig into ActionDto.

The url is not passed into the ActionConfig on the first transformation and so the ActionConfig is overwritten on the last transformation.

This makes this behaviour strange with a loss of parameters due to the use of update to add css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant