CRM-11823 Core Resources Not Added Outside CiviCRM

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Pretty sure this is related to the crm-container changes. View is more messed up. Edit is using the Drupal layout (label above field) which might be ok to leave as-is ??

        Attachments

          Issue Links

            Activity

            [CRM-11823] Core Resources Not Added Outside CiviCRM
            Coleman Watts added a comment -

            Actually this is related to the CRM_Core_Resources changes. Our js is no longer being added to the page when civicrm_initialize is called, which is a problem.
            totten you recently fixed something very similar to this, would you be willing to take a look?

            Tim Otten added a comment -

            A few things:

            • I did make some changes (r45192) which stopped our resources from loading on the edit-user screen.
            • My changes broke it because I made the same assumption Coleman made above – i.e. that calling civicrm_initialize() is sufficient for populating the resources. That's never been the case – it only does this when the current request-path is under '/civicrm'. For non-Civi pages, we need to provide some alternate means of registering resources.
            • So I fixed the edit page (r45516) by forcing it register the core scripts when using a certain (old) helper function that was intended for this use-case. This is closer to how the code behaved before.
            • The problem with the view-user screen predates r45192. Still poking around to figure out what's going on with that...
            Tim Otten added a comment -

            So I found that the behavior of civicrm_html_head() had actually changed – before, the JS (and most CSS) would only load on civicrm pages – but a 3 specific CSS files would load on all pages. r45519 partially reproduces this – it registers the CSS files on all pages.

            However, there's a problem with how the html-header is produced. Our current mechanism for rendering the HTML header region kicks off in CRM_Core_Page (and a few similar spots like CRM_Core_QuickForm_Action_Display). However, on non-Drupal pages, we never get the 'kick-off'.

            We can hack this into the specific Drupal pages that we need, but I think it would be brittle – if downstream devs get ambitious with mixing together blocks/pages/panels (e.g. creating a panel-page which embeds pages created by Civi extensions that use their own CSS/JS), then we're likely to get weird/unintuitive results (eg redundant resource loading).

            I think we need to change the way we kick-off rendering of the header region. The kick-off should be initiated whenever the CMS decides to render the header. For example, on Drupal, this might be hook_html_head_alter.

            Coleman Watts added a comment -

            Adding a link to CRM-11869 since they are related

            Tim Otten added a comment -

            For this and for CRM-11834, I've been working on changes to html-header. Some of my notes are on the wiki

            http://wiki.civicrm.org/confluence/display/CRMDOC43/HTML+Header+Region

            Tim Otten added a comment -

            Changes were merged into upstream/master by way of https://github.com/civicrm/civicrm-core/pull/166 (and other linked PRs).

            There's currently some dead code referencing CIVICRM_UF_HEAD. This can help us to go back to the old behavior if necessary – we should probably remove this fallback mechanism sometime after 4.3.beta4 but before 4.3.0.

            If testing this on an existing Drupal-based dev site, it may be necessary to clear Drupal's cache. The install and upgrade processes sometimes use JS/CSS. Prior to the merge, I retested install/upgrade across all CMSs.

            Ravish Nair added a comment -

            Checked edit and view pages of "My Account". Working fine.

              People

              • Assignee:
                Ravish Nair
                Reporter:
                David Greenberg

                Dates

                • Created:
                  Updated:
                  Resolved: