Hot answers tagged

6 votes
Accepted

How to reset the headless test db?

ah-ha! In your test class edit the setUpHeadless() method which might look at first like this: public function setUpHeadless() { ...
user avatar
  • 3,688
6 votes
Accepted

Civix reports "Failed to locate civicrm.settings.php"

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 ...
user avatar
  • 5,589
5 votes
Accepted

What are `*.mgd.php` files for?

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 ...
user avatar
  • 1,561
5 votes
Accepted

Create new contact sub-type when extension is installed

A contact subtype is an "entity" - it exists as a record in the civicrm_contact_type table. So that means you can use the "managed entity" approach described here: https://civicrm.org/blog/totten/api-...
user avatar
  • 5,994
4 votes

Display menu and pages of a newly created extension

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.
user avatar
  • 16.2k
4 votes

Does class autoloading not work in standalone phpunit testing?

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, ...
user avatar
  • 5,589
4 votes

Civicrm:ping INI file not found

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 ...
user avatar
  • 1,489
4 votes
Accepted

How can I locate my extension directory?

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 ...
user avatar
4 votes
Accepted

Creating extension with civix: How to use CRM dir?

Overriding core files was how we used to make changes until collectively we figured out that was storing up trouble for the future. Another possibility is that if you think this is likely to be a ...
user avatar
  • 11k
3 votes
Accepted

"Unknown path" when viewing a newly generated angular page

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

How can I locate my extension directory?

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())->...
user avatar
  • 1,561
3 votes
Accepted

Add new smarty template to an existing page

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 ...
user avatar
3 votes
Accepted

How to Add Menu Item to Parent Using Civix

Example: /** * Implements hook_civicrm_navigationMenu(). * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_navigationMenu/ */ function dmfactuurlink_civicrm_navigationMenu(&$...
user avatar
3 votes
Accepted

Create a extension for civicrm

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 ...
user avatar
3 votes

How to install civix and build an extension in drupal

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 ...
user avatar
3 votes

Creating a custom Form: Action (view vs update)

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 ...
user avatar
3 votes

Creating extension with civix: How to use CRM dir?

The simple answer to "Can I use the CRM directory that is auto-created by civix to easily store custom versions of existing CiviCRM PHP files?" is no, not easily. While it can be made to ...
user avatar
  • 17.9k
2 votes
Accepted

Error in civix generate:api "You cannot change the session module's ini settings at this time"

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?
user avatar
  • 1,960
2 votes

Error in civix generate:api "You cannot change the session module's ini settings at this time"

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 ...
user avatar
  • 10.1k
2 votes

Civix: Install error: API error: DB Error: already exists

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 * ...
user avatar
2 votes

How can I make a custom report that displays info for three contacts based on relationships?

If you are using Drupal then a View may be able to deliver you the required solution with less head aches.
user avatar
  • 27.1k
2 votes

How can I make a custom report that displays info for three contacts based on relationships?

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' ...
user avatar
2 votes
Accepted

Does class autoloading not work in standalone phpunit testing?

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/...
user avatar
2 votes

Civicrm:ping INI file not found

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 ...
user avatar
  • 185
2 votes
Accepted

How do I write the _spec function for my custom API?

After a bit of research I added documentation which explains how to write _spec functions: https://docs.civicrm.org/dev/en/latest/framework/api-architecture/#spec
user avatar
  • 3,148
2 votes

how to import extension to civicrm

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> ...
user avatar
2 votes

Development on a plugin - How to transfer values

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 ...
user avatar
2 votes

Civix not working Joomla! 3.9.3

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.
user avatar
  • 1,222
2 votes
Accepted

civix civicrm:ping error [Exception] Failed to locate civicrm.settings.php

Cool - in the drupal site root of the site you should see a folder "sites" and be able to see a file at sites/default/civicrm.settings.php can you try running the command from the same directory as ...
user avatar
  • 1,685
2 votes

civix civicrm:ping error [Exception] Failed to locate civicrm.settings.php

The /build/dmaster/web/sites/default folder has the civicrm.settings.php file, you can execute the commands from anywhere in/or below the web directory. This will allow civix to correctly locate the ...
user avatar

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