Comments

liber_t created an issue. See original summary.

liber_t’s picture

liber_t’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new15.06 KB

Improve code and add settings (hide cmis operations, hide breadcrumb) OK

liber_t’s picture

Assigned: liber_t » Unassigned
liber_t’s picture

StatusFileSize
new17.19 KB
new1.8 KB

If instantiate a new CMIS field, I have an error:
Error: Call to a member function getCmisUrl() on null in Drupal\cmis\CmisConnectionApi->setDefaultParameters() (line 144 of modules/contrib/cmis/src/CmisConnectionApi.php).

liber_t’s picture

Assigned: Unassigned » liber_t
Status: Needs review » Needs work

Another bug,

If I am in node with Cmis browser field and I upload file or create folder, I am redirect to cmis url not the node url

liber_t’s picture

Assigned: liber_t » Unassigned
Status: Needs work » Needs review
StatusFileSize
new17.57 KB

Fix cache in browser widget & form redirect (upload and create folder)

liber_t’s picture

Implement permission (Action CAN_CREATE_FOLDER and CAN_CREATE_DOCUMENT) in operation route

Depend on https://www.drupal.org/project/cmis/issues/3165959

liber_t’s picture

Add check permission Action::CAN_DELETE_OBJECT in delete link.
I don't remove "access cmis operations" permission in this patch. I'm going to deleting in "Add permission per entity" issue

liber_t’s picture

StatusFileSize
new18.7 KB
liber_t’s picture

Fix widget title and remove cmis operations permissions

Can you replace
_permission: 'access cmis operations'
per
_custom_access: '\Drupal\cmis\Controller\CmisRepositoryController::access'
when the "Add permission per entity" issue as merged in routing.yml ?

Regards,

ps: 9 and 11 is same patch (just number of comment as been changed

liber_t’s picture

StatusFileSize
new20.65 KB

Missing FieldFormatter/CmisFieldBrowser.php

grimreaper’s picture

Assigned: Unassigned » grimreaper
grimreaper’s picture

Status: Needs review » Needs work
  1. +++ b/config/schema/cmis.schema.yml
    @@ -12,3 +12,6 @@ field.widget.settings.cmis_field_widget:
    +    show_breadcrumb:
    

    Nope. This is the schema of the widget.

    You need to make a schema for the field formatter.

  2. +++ b/src/CmisBrowser.php
    @@ -275,45 +285,66 @@ class CmisBrowser {
    +    if ($this->connection->hasAllowableActionById($this->current->getId(), Action::CAN_CREATE_FOLDER)) {
    

    $this->current->getId() put into a variable.

  3. +++ b/src/CmisBrowser.php
    @@ -275,45 +285,66 @@ class CmisBrowser {
    +        if (strpos($route_name, 'browser') !== FALSE) {
    

    A comment on why this if would be appreciated.

  4. +++ b/src/CmisBrowser.php
    @@ -336,23 +367,24 @@ class CmisBrowser {
    +    if (strpos($route_name, 'browser') !== FALSE || ($this->additionalSettings && $this->additionalSettings['show_breadcrumb'])) {
    

    This needs a comment.

  5. +++ b/src/CmisElement.php
    @@ -120,33 +121,8 @@ class CmisElement {
         $link_options = [];
    

    Unused variable.

  6. +++ b/src/CmisElement.php
    @@ -120,33 +121,8 @@ class CmisElement {
    +
    

    Uneeded empty line.

  7. +++ b/src/CmisElement.php
    @@ -262,6 +240,58 @@ class CmisElement {
    +
    

    Uneeded empty line.

  8. +++ b/src/CmisElement.php
    @@ -290,9 +320,9 @@ class CmisElement {
    +    if ($this->rootId != $this->element->getId() && $cmis_connection_api->hasAllowableActionById($this->element->getId(), Action::CAN_DELETE_OBJECT)) {
    

    Put $this->element->getId() in a variable to avoid several calls.

  9. +++ b/src/Plugin/Field/FieldFormatter/CmisFieldBrowser.php
    @@ -0,0 +1,103 @@
    +      '#type' => 'checkbox',
    

    #type first please :)

  10. +++ b/src/Plugin/Field/FieldFormatter/CmisFieldBrowser.php
    @@ -0,0 +1,103 @@
    +    $summary[] = ($settings['show_breadcrumb'] == 1) ? $this->t('Show breadcrumb : Yes') : $this->t('Show breadcrumb : No');
    

    No space before punctuation with double points in english :)

  11. +++ b/src/Plugin/Field/FieldFormatter/CmisFieldBrowser.php
    @@ -0,0 +1,103 @@
    +    $elements['#cache']['max-age'] = 0;
    +    $elements['#cache']['contexts'] = [];
    +    $elements['#cache']['tags'] = [];
    

    I understand that there is currently no cache mecanism possible because the content displayed inside is from an external source.

    Maybe creating a cache tag per folder ID and flushing this cache tag when modifying a folder content. But the current code base will not help to do that.

    To avoid preventing the whole page to be cacheable, maybe we can do a lazy_builder approach. See https://github.com/Drupal-FR/site-drupalfr/blob/8.x-1.x/www/modules/cust...

  12. +++ b/src/Plugin/Field/FieldFormatter/CmisFieldBrowser.php
    @@ -0,0 +1,103 @@
    +    $config_path = explode('/', $item->get('path')->getValue(), -1);
    

    -1 needs a comment.

  13. +++ b/src/Plugin/Field/FieldWidget/CmisFieldWidget.php
    @@ -10,12 +10,15 @@ use Drupal\Core\Field\WidgetBase;
    +use Drupal\cmis\Controller\CmisRepositoryController;
    

    Unused statement.

  14. +++ b/src/Plugin/Field/FieldWidget/CmisFieldWidget.php
    @@ -10,12 +10,15 @@ use Drupal\Core\Field\WidgetBase;
    + *   module = "cmis",
    

    Why add this? It does not seem to be in the annotation.

Now, I will manually test the patch.

grimreaper’s picture

Also, here is a rebased patch, because patch from comment 12 didn't apply any more.

I made some changes of the previous review.

grimreaper’s picture

Assigned: grimreaper » liber_t
liber_t’s picture

StatusFileSize
new28.79 KB
new7.58 KB

All point is ok

liber_t’s picture

Assigned: liber_t » grimreaper
Status: Needs work » Needs review
grimreaper’s picture

Assigned: grimreaper » liber_t
Status: Needs review » Needs work

Seen together. When the show breadcrumb option is unchecked, it is ok on the first display of the browser. But when going into a folder, then the breadcrumb is displayed again.

grimreaper’s picture

Schema.yml is wrong.

grimreaper’s picture

Assigned: liber_t » grimreaper
Status: Needs work » Reviewed & tested by the community

Seen together about the show breadcrumb settings not transmitted. I have created a child issue because currently with the module architecture, it is difficult/impossible to do better in a generic way.

Going to merge the patch.

  • liber_t authored 4bee051 on 8.x-2.x
    Issue #3164884 by liber_t, Grimreaper: New FieldFormatter to show CMIS...
  • Grimreaper authored e2f04ac on 8.x-2.x
    Issue #3164884 by liber_t, Grimreaper: New FieldFormatter to show CMIS...
grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.