Details

    • Type: Sub-task
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      For CRM-12863, we would like to apply a very small amount of CSS to specific profile forms. To do this properly (without affecting other profiles that are concurrently embedded in the same page), we should:

      1. Add

      {crmRegion name="profile-NAME"}

      to Dynamic.tpl
      -> this allows one to inject code in the profile programmatically

      2. Add <div class="crm-profile-NAME"> to Dynamic.tpl
      -> this allows one to manipulate layout/rendering of profile with CSS

      3. Define hooks for the "build/validate/process" phases of profile-form-processing and the "run" phase of profile-page-processing. The hooks should emit the NAME of the profile form.
      -> This isn't strictly needed. It can be done with the buildForm/validateForm/postProcess/pageRun hooks, but it's a bit verbose/cumbersome because (a) you have to check for CRM_Profile_Form_Dynamic (or similar) and (b) you have to get the profile GID, and (c) you have to map the GID to the profile's name to determine if it's the right profile. With a large #modules, this will become a lot of checks. More generally, from the perspective of a developer working with profiles, it feels a bit leaky to dig into the properties of CRM_Profile_Form_Dynamic.
      -> This could be done by defining a parallel set of hooks (hook_civicrm_buildProfile, hook_civicrm_validateProfile, hook_civicrm_processProfile, hook_civicrm_runProfile).
      -> This could (mosty) be done by calling the existing hooks an extra time with a better $formName – e.g. hook_civicrm_buildForm($formName,...) where "$formName" is "CRM_Profile::my_uf_group_name".

      Note: Before closing the ticket, please update the Region Reference, Hook Reference, and API changelog.

        Attachments

          Issue Links

            Activity

            [CRM-13504] Define hook/CSS/region names for profile forms
            Erik Hommel added a comment -

            +1 for th parallel set of hooks

            Eileen McNaughton added a comment -

            I think an extra set of hooks is warranted. I'd personally like to see the array of data that describes the form rather than the form object passed to developers. (a more drupal like hook)

            Tim Otten added a comment -

            Submitted PR https://github.com/civicrm/civicrm-core/pull/1144/

            Note that #1144 introduces new hooks which do the bare minimum – they supply only the profile name. For the current use-cases of injecting JS/CSS/markup into the profile, this seems sufficient. We can have the longer discussion of additional parameters when somebody needs them.

            Tim Otten added a comment -

            Todo: Update wiki

              People

              • Assignee:
                Tim Otten
                Reporter:
                Tim Otten

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 day, 4 hours
                  1d 4h
                  Remaining:
                  Time Spent - 4 hours, 30 minutes Remaining Estimate - 7 hours, 30 minutes
                  7h 30m
                  Logged:
                  Time Spent - 4 hours, 30 minutes Remaining Estimate - 7 hours, 30 minutes
                  4h 30m