Hot answers tagged

5

ah-ha! In your test class edit the setUpHeadless() method which might look at first like this: public function setUpHeadless() { // Civi\Test has ...


5

So a little research takes me to Totten's blog where he lays out the rational for splitting out entity definitions into seperate PHP files. The full definition of the array format is laid out in the hook_civicrm_managed guide and an example .mgd.php file is here


5

The generate:api subcommand (and a few others) require access to a working copy of CiviCRM. To locate this, it uses a process reminiscent of drush or wp-cli. For example, if the command-line is running inside /var/www/sites/default/files/civicrm/ext/org.example.foo/, then it will perform an upward search to find the CMS root: /var/www/sites/default/files/...


4

Whenever you modify a menu xml file you must clear CiviCRM's menu cache. Go to Administer > System Settings > Cleanup Caches & Update Paths and click the Cleanup Caches button.


4

This is an issue with intermediate base-classes for tests (like VolunteerTestAbstract). The most reliable solution I've found is to put a require_once to load the intermediate base-class. For example, this is what I used in uk.co.vedaconsulting.mosaico: require_once __DIR__ . '/TestCase.php'; class CRM_Mosaico_MosaicoTemplateTest extends ...


4

I was just dealing with this and found your question.. Since you used C:\, i'll assume you're in windows. TLDR; Try checking your PHP environment variable for 'HOMEPATH' vs 'HOME' and editing the file I mention below. The first thing I will say is that you can increase verbosity of errors in civix by using -v, -vv, or -vvv options for most verbose. It ...


4

You can find your extension directory by going to Administer menu » System Settings » Directories and checking the value for the "Extensions" directory. If there's a token like [civicrm.root], you can determine its value with this technique.


3

In PHP it looks like this is what I need: return (new CRM_Extension_System())->getDefaultContainer()->baseDir; So in bash I can use cv: cv ev 'return (new CRM_Extension_System())->getDefaultContainer()->baseDir' or better still, as pointed out be Tim: cv ev 'return CRM_Core_Config::singleton()->extensionsDir' which means this one liner ...


3

I am assuming you want to add some stuff at the bottom of the activity page, correct? First of all, you need to establish if you are adding to a civicrm page or form. You can do a little test with the hook buildForm (see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/) and check the formName or with the hook pageRun (see https://docs....


3

Example: /** * Implements hook_civicrm_navigationMenu(). * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu/ */ function dmfactuurlink_civicrm_navigationMenu(&$menu) { _dmfactuurlink_civix_insert_navigation_menu($menu, 'Administer', array( 'label' => E::ts('Domus Medica Factuur Link Instellingen'), 'name'...


3

Have a look at the Developer Guide here: https://docs.civicrm.org/dev/en/latest/ as a start. If at all possible I would recommend trying to find an expert near you who would be able to give you a developer training. You would have to pay for it but it will probably save you a lot of exploration time :-)


3

Paul B, Its not necessary to have 2 separate tpl for View and edit, the logic can be added in one tpl or php file. But for convenience Civi tries to keep it separate. A good example for view and add form will be New/Update/ View Membership forms. The action for CRUD is registered here https://github.com/civicrm/civicrm-core/blob/master/CRM/Member/xml/Menu/...


2

Hit this one last month, and created a bug for it: https://issues.civicrm.org/jira/browse/CRM-16218 Are you using WordPress, by any chance?


2

As a workaround, you can create manually the Create.php file that contains civicrm_api3_invoice_create() Check the api/v3 folder in the core for examples (eg. the email one) As for civix, do you have the latest version? if it's the case, fill a bug on github


2

After posting my comment, I did a little bit of digging into what the CRM_Core_ManagedEntities::reconcile function does. It says: * Identify any enabled/disabled modules. Add new entities, update * existing entities, and remove orphaned (stale) entities So it would seem that it's confused because "Benefits Specialist Is" is a relationship associated with ...


2

If you are using Drupal then a View may be able to deliver you the required solution with less head aches.


2

When starting on reporting I did a lot of debugging in my report and in the parent class to find out what was happening. Your specific error: I strongly suspect 'relationship_type_c_civireport.label' should be 'relationship_type_id_c....' but I am not sure. Check if there is a postProcess function in your class. If there is, it should call the parent ...


2

Civi's autoloader does not load classes outside the CRM directory. In order for that to work, you'll have a few options: Implement your own autoloader capable of loading classes inside the test/phpunit dir Use require to include the class Put the VolunteerTestAbstract class inside your CRM dir I usually use the second option for that and include/require ...


2

I believe you first need to generate a module, à la civix generate:angular-module. Have you already done that?


2

I was about to take Eli's approach, but then I realized it is much simpler: close your current cmd shell/terminal; press Win + R, type setx CV_CONFIG "%userprofile%\.cv.json" and press Enter; reopen the shell, goto your project's directory and test with civix civicrm:ping -vvv. Alternatively, if you prefer to check/set environment variables for your ...


2

in fact I am going in: administration> system setting> extension With the above, I think you are able to access CiviCRM on the site. To see the extension in the administration> system setting> extension path, make sure you run the civix command in the extension directory, i.e - Navigate to Administer -> System Setting -> Directories. Check the ...


2

You need to install civix to create civicrm extension and then follow documentation for creating module extension. There are many examples of extension under civicrm.org. The easiest one to start would be https://civicrm.org/extensions/api-key https://civicrm.org/extensions/phone-number-validator https://civicrm.org/extensions/show-contact-deceased https://...


2

Ok, I think I figured this bit out by using... $this->_contactId = CRM_Utils_Request::retrieve(... and making sure the calling url has cid={$contactId} included. I'm getting the contactID in the php code, which will allow me to execute the queries and such I need to list out the details. Norm


2

OK, it looks like it's a problem with Joomla 3.9.3. See discussion here. Fix should be included in Joomla 3.9.4, which is out on 12th March.


1

It's also worth noting that if you're using civicrm-buildkit to create your test sites (highly recommended) you can also rebuild a site with civibuild reinstall.


1

Shortcut to Eli's answer; just civix civicrm:ping -vvv and check for ...\civix\vendor\civicrm\cv\src\Config.php. If you find it, it means you need to change HOME to HOMEPATH. From elseif (getenv('HOME')) { return getenv('HOME') . '/.cv.json'; } to elseif (getenv('HOMEPATH')) { return getenv('HOMEPATH') . '/.cv.json'; }


1

It looks like like perhaps you are developing your extension within a normal CiviCRM installation instead of a development installation. If this is the case, you'll need to set up a development installation in order to get the xml folder (and other things too). The best way to set up a development installation is to use the civibuild tool which you will ...


1

It sounds like perhaps you are developing your extension within a normal CiviCRM installation instead of a development installation. If this is the case, you'll need to set up a development installation in order to get the xml folder (and other things too). The best way to set up a development installation is to use the civibuild tool which you will get if ...


1

You need to install civicrm using buildkit to ensure you have all the dependencies / tools / files. Then have a look here: https://docs.civicrm.org/dev/en/master/extensions/civix/ Examples of extensions that have done it (see ./bin/setup.sh for a scripted method of DAO creation): https://github.com/civicrm/org.civicrm.volunteer And https://github.com/3sd/...


1

civix is now capable of generating the SQL and DAO with: civix generate:entity-boilerplate. The civix documentation gives more info.


Only top voted, non community-wiki answers of a minimum length are eligible