πŸ‡ΊπŸ‡ΈUnited States @thhafner

Account created on 22 January 2014, over 10 years ago
#

Merge Requests

Recent comments

πŸ‡ΊπŸ‡ΈUnited States thhafner

I tested with the ternary operator and it works as expected with s3fs. I have not validated it with a standard public filepath yet.

πŸ‡ΊπŸ‡ΈUnited States thhafner

@jmdeleon need to use a ternary operator instead of null coalescing as realpath returns a string or FALSE not NULL when it cannot find the file.

https://www.php.net/manual/en/function.realpath.php#refsect1-function.re...

πŸ‡ΊπŸ‡ΈUnited States thhafner

thhafner β†’ created an issue.

πŸ‡ΊπŸ‡ΈUnited States thhafner

For completeness, this issue describes the problem and solution very well.

https://www.drupal.org/project/s3fs/issues/3352993#comment-15002764 πŸ’¬ Is it expected that s3fs will override Drupal\Core\File\FileSystem service? Fixed

πŸ‡ΊπŸ‡ΈUnited States thhafner

Patch for #88 ✨ Implement a generic revision UI Fixed did not upload correctly. Reuploading.

πŸ‡ΊπŸ‡ΈUnited States thhafner

Pushing this issue along a bit. Made updates that do not require a great deal of additional discussion.

Remaining Tasks:

  1. +++ b/core/lib/Drupal/Core/Entity/EntityBase.php
    @@ -196,7 +196,7 @@ public function toUrl($rel = 'canonical', array $options = []) {
    -    if ($rel === 'revision' && $this instanceof RevisionableInterface && $this->isDefaultRevision()) {
    +    if (in_array($rel, ['revision', 'revision-revert-form'], TRUE) && $this instanceof RevisionableInterface && $this->isDefaultRevision()) {
    

    The patch over at #2927077: $entity->toUrl('revision-*') β†’ should fill revision parameter on all applicable routes. has looser logic and checks any link that starts with 'revision':

    > However, entity annotations can provide other revision-specific routes, such as "revision_revert" or "revision_delete"

    Should that apply here too?

  2. private function getHandlerClassWithImplementationChecks(EntityTypeInterface $entity_type, $handler, $implementing_class) {
    

    I'm confused by why we need this helper method. There's perhaps a case to be made for all entity handlers to get checked against the interface they ought to be implementing. But that's a wider issue. (And also one that leads to other issues to with declaring handler types in a formal manner, so we can declare the interface they need to have.)

  3. if ($entity_type->hasLinkTemplate('version-history') && $version_history_class = $this->getHandlerClassWithImplementationChecks($entity_type, 'version_history', VersionHistoryControllerInterface::class)) {
    

    This pattern isn't used by the other entity route providers -- they hardcode the controller class they use for their routes. I think it's best not to invent too many new patterns at once.

    There's a case to be made in a follow-up for introducing a "controllers" annotation that mirrors the "route_provider" annotation, as I for one have often subclasses route providers just to switch the controller class set in route callbacks.

  4. Also, I'm not seeing a test entity type with a 'revision_revert' form class defined, so it looks like the test coverage is incomplete.
  5. public function access(Route $route, AccountInterface $account, RouteMatchInterface $route_match = NULL) {
    

    Rather than inheritdoc, follow the pattern of EntityAccessCheck and document what this access checker expects in the route.

  6. protected function checkAccess(ContentEntityInterface $entity, AccountInterface $account, $operation = 'view') {
    

    Missing docs.

  7. operation = $route->getRequirement('_entity_access_revision');
    

    AFAIK, an access checker needs to be declared as a service, with the requirements key, '_entity_access_revision' in our case, also declared in services.yml. E.g.:

    access_check.entity_revision:
      class: Drupal\Core\Entity\EntityRevisionAccessCheck
      arguments: ['@entity_type.manager', '@current_route_match']
      tags:
        - { name: access_check, applies_to: _entity_access_revision }
    

    Without this, I get an access denied on the routes.

    Though, why do we need @current_route_match as an injection?

  8. if (empty($route_match)) {
      $route_match = $this->routeMatch;
    }
    

    Why do we need this? The access() method gets it as a parameter.

  9. * @return string
     *   Returns a string to provide the details of the revision.
     */
    abstract protected function getRevisionDescription(ContentEntityInterface $revision, $is_current = FALSE);
    

    but VersionHistoryController::getRevisionDescription() doesn't return a string but an array.

Production build 0.69.0 2024