Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-2169

Allow action links to specify base URI

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0-b1
    • Component/s: None
    • Labels:
      None

      Description

      The base URI for plugin action nav links is determined automatically by the context of the link.

      This becomes problematic, however, if we wish to define a primary client nav element that is based off the public URI. The solution is to add the ability to overwrite the base URI via an option.

      • base_uri - The base URI (optional)
        • "public" - The public URI path
        • "client" - The client URI path
        • "admin" - The admin URI path
        • Any other string, e.g. "https://blesta.com/"

      The base_uri option should be supported as a top-level key, as well as within any sub element that also contains a uri key. For example:

      [
          'action' => 'nav_primary_client',
          'base_uri' => 'public',
          'uri' => 'order/',
          'name' => 'Order',
          'sub' => [
              [
                  'name' => 'Dippin Dots',
                  'uri' => '',
                  'base_uri' => 'https://www.dippindots.com'
              ]
          ]
      ]
      

      The top-level base_uri SHOULD overwrite the base_uri for all sub elements unless explicitly overridden by a sub element. If no top-level base_uri is defined, it should inherit the default base_uri as it does today.

      The Navigation model requires updates in order to support this.

      public function baseUri($label, $uri)
      {
          $this->base_uris[$label] = $uri;
          return $this;
      }
      

      Then in AppController:

      $this->Navigation->baseUri('public', $this->public_uri);
          ->baseUri('client', $this->client_uri);
          ->baseUri('admin', $this->admin_uri);
      

        Issue Links

          Activity

          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          It looks to me like the 'nav_secondary_staff' action will require two additional options:

          • base_uri - The secondary subnav URI
          • parent_base_uri The URI of the parent.

          The parent_base_uri would be necessary if a plugin wanted to add a secondary URI to a parent (e.g. of a plugin) that also overrides its base_uri.

          Show
          tyson Tyson Phillips (Inactive) added a comment - It looks to me like the 'nav_secondary_staff' action will require two additional options: base_uri - The secondary subnav URI parent_base_uri The URI of the parent. The parent_base_uri would be necessary if a plugin wanted to add a secondary URI to a parent (e.g. of a plugin) that also overrides its base_uri.
          Hide
          cody Cody Phillips (Inactive) added a comment -

          I think it's a rare case to have a plugin attempt to add secondary URI to another plugin so not sure we need to cover that. At least not right now.

          Show
          cody Cody Phillips (Inactive) added a comment - I think it's a rare case to have a plugin attempt to add secondary URI to another plugin so not sure we need to cover that. At least not right now.

            People

            • Assignee:
              tyson Tyson Phillips (Inactive)
              Reporter:
              cody Cody Phillips (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Sep/16