6

I'm attempting to move code from an angular extension into core. I've created an ang/crmModuleName and moved the ctrl and partials into it, and crmModuleName.css into the ang/ and crmModuleName.js into the ang/. I've modified Civi/Angular/Manage.php to include js, css, partials, settings. Cleared cache on local server, but it is not working.

Is there another step I've missed?

  • Yes, the main trick should be registering js, css, partials, and settings in Civi/Angular/Manage.php. I'd suggest posting a PR with a comment about the problem. – Tim Otten Oct 13 '15 at 15:58
3

Here's the detailed steps I took to move the angular extension from an extension and into core.

  1. if your angular files are not already name spaced, they should be changed. In the angularextension there should be a folder in ang/ named something similar to the module. Namespace this folder to crmModuleName. Outside of the crmModule folder, but inside the ang folder should be your css and the file that creates the module and has the router in it. Namespace these files to crmModuleName.css and crmModulename.js.

  2. Move the crmModulename folder and files to the ang/ folder in CiviCRM core. It should mimic the directory structure of your extension.

  3. There should be a file in the ang/ folder in your extension that is modulename.ang.php - it should have an array that points to where the files in your extension are located:

    <?php
    return array(
      'js' => array(
        0 => 'ang/crmModuleName.js',
        1 => 'ang/crmModuleName/*.js',
        2 => 'ang/crmModuleName/*/*.js',
      ),
      'css' => array(
        0 => 'ang/crmModuleName.css',
      ),
      'partials' => array(
        0 => 'ang/crmModuleName',
      ),
      'settings' => array(),
    );
    
  4. Find the file Civi/Angular/Manage.php. Within the public function getModules put the information from modulename.ang.php. It should look like this:

    $angularModules['modulename'] = array(
      'ext' => 'civicrm',
      'js' => array('ang/crmModuleName.js', 'ang/crmModuleName/*.js'),
      'css' => array('ang/crmModuleName.css'),
      'partials' => array('ang/crmModuleName'),
      'settings' => array(),
    );
    
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.