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
Port Path Alias Delete to D8 #109
Port Path Alias Delete to D8 #109
Conversation
*/ | ||
public function execute() { | ||
$path = $this->getContextValue('path'); | ||
$alias = $this->aliasManager->getAliasByPath($path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to load the alias? You can just pass the path as condition to the delete() method? That should delete all aliases for that path?
Why do you need to load the alias? - good question, it's my current blurred understanding of the changes from procedural to OO. It'll get there, I'm old, it takes longer to sink in these days :D Have removed references to aliasmanager and squashed the commit. |
|
||
use Drupal\Core\Plugin\Context\ContextDefinition; | ||
use Drupal\rules\Plugin\Action\PathAliasDelete; | ||
use Drupal\rules\Tests\RulesUnitTestBase; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That file has been moved, that's why the tests are failing. Make sure to run the phunit tests locally.
Oops, I'd realised they'd been fixed but I thought for a moment my local 8.x-3.x branch was just out-of-date but wasn't. Fixed. |
Right, think I've got it :D |
…338595 Port Path Alias Delete to D8
* | ||
* @Action( | ||
* id = "rules_path_aliases_delete", | ||
* label = @Translation("Delete alias for a path"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete a path alias
Here's an initial stab at the "Delete alias for path". Unsure currently how to deal with multiple values, i.e. if there's more than one alias for the path, couldn't see a relevant function in the AliasManager for this.