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() { ...
artfulrobot's user avatar
  • 3,920
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 ...
Tim Otten's user avatar
  • 5,684
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 ...
ErichBSchulz's user avatar
  • 1,571
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-...
Alan Dixon's user avatar
  • 6,786
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, ...
Tim Otten's user avatar
  • 5,684
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 ...
Jon G - Megaphone Tech's user avatar
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 ...
Eli Lisseck's user avatar
  • 1,499
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 ...
Aidan's user avatar
  • 13.4k
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 ...
ErikH - CiviCooP's user avatar
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?
universalhandle's 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())->...
ErichBSchulz's user avatar
  • 1,571
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(&$...
ErikH - CiviCooP's 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 ...
Pradeep Nayak's 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 ...
ErikH - CiviCooP's 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 ...
Pradeep Nayak's 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 ...
Demerit's user avatar
  • 22.5k
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/...
Davi Alexandre's user avatar
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> ...
jitendra - fuzion's 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 ...
Armfoot's 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
Sean's user avatar
  • 3,168
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 ...
Norm Dressler's 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.
Jern's user avatar
  • 1,300
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 ...
Luke Stewart's user avatar
  • 1,855
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 ...
Asha's user avatar
  • 121
1 vote

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

As per https://github.com/civicrm/civicrm-core/blob/master/api/v3/Dashboard.php#L64 you can set default values, You can also specify the type and even limit to specific options see https://github.com/...
Seamus Lee's user avatar
  • 1,289
1 vote

How to reset the headless test db?

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.
Jon G - Megaphone Tech's user avatar
1 vote

Install error when generating a new extension module

You should run civix generate:module "com.example.myextension in directory where all the other CiviCRM modules reside - /your_drupal_project_root/sites/all/modules/civicrm/ext for Drupal 7 + CiviCRM 4....
Vadim Sushin's user avatar
1 vote

Install error when generating a new extension module

Check the Extensions Directory specified at Administer > System Settings > Directories. Your extension needs to be in that directory. If not, either move your code or change the setting.
Aidan's user avatar
  • 13.4k
1 vote
Accepted

creating scheduled api using civix

I think your action is way too long and possibly separated into a few words in your function name? Can you check?
ErikH - CiviCooP's user avatar
1 vote

How to create entity in CiviCRM

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 ...
Sean's user avatar
  • 3,168

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