23
votes
How would you anonymise (or redact) private data for developer stage?
Some thoughts
Anonymizing data is hard work.
Eg: Would it be OK if your developer could de-anonymize your contacts by identifying from geolocated data? What about identifying by "metadata", if ...
16
votes
Accepted
How do I get more than 25 records from the API?
To return more than 25 results you need to add options.limit to your api call:
$params = array(
'version' => 3,
'sequential' => 1,
'membership_type' => 1,
'options' => array(
...
Community wiki
15
votes
How do I set up dev environment with buildkit?
As Kurund pointed out, the general instructions are at https://github.com/civicrm/civicrm-buildkit . Follow those instructions to download the all the tools.
There are a few details that may not be ...
14
votes
Accepted
What are the different cache clearing mechanisms relevant when developing?
For the first example, you need to 1. clear the compiled Smarty templates cache. In the second case you need to 2. rebuild the menu system using your xml file. 3. There are some db cache tables you ...
10
votes
Accepted
How do I test a CiviCRM upgrade script?
If you have installed civicrm-buildkit and configured civibuild, then you can use the tutorial steps at Daily Coding: Upgrade Tests.
If you don't use civibuild, then you can piece-together a similar ...
9
votes
What are the different cache clearing mechanisms relevant when developing?
+1 for Joe's comment which is pretty thorough.
Re: drush cc all -- this command can be pretty important in the workflow for Drupal dev. In Civi-Drupal, the analogous command is drush cvapi system....
9
votes
Accepted
CiviCRM and Docker
PTP has been experimenting with docker for a few months and is planning to use it in production soon (to replace our aegir provisioning system). I've just been working today on finishing a Docker file ...
9
votes
Accepted
How to increase limits on activity attachments?
Go to configure it in your settings
/civicrm/admin/setting/misc?reset=1
9
votes
Accepted
How to develop extension that relies on libs brought in by composer
Approaches
There are a few different patterns one could follow in connecting Civi extensions with composer:
(Broad scope) Site build via composer: The entire web site is defined with a custom ...
9
votes
Accepted
How can I use Xdebug with CiviCRM unit tests?
Xdebug configuration is a somewhat temperamental issue -- the details depend on the IDE, the PHP build, host OS, target application, test suite, etc. Providing a good answer to this is tricky -- e.g. ...
9
votes
How do I make the menubar a different color on my dev/staging sites
As of CiviCRM v5.12.1 the menubar color is a configurable setting.
On your main site you can change the color via the UI by visiting Administer -> Customize Data & Screens -> Display Preferences.
...
8
votes
How do I get more than 25 records from the API?
Well here's an alternate way to try which returns the total result if you have no idea how much entries does the returned result will contain :
$count = civicrm_api('Membership', 'getcount', $params);...
8
votes
Accepted
How to print variable/debug data from your extension.php?
(Update) As of v4.7.0, the approaches below still work, but there's a better way to write to the log file using a PSR-3 logger, e.g.:
Civi::log()->info('Hello, log!');
Civi::log()->error('I'm ...
8
votes
Accepted
Find CiviCRM version programmatically?
Agree with Chris that System.get is a great API for inspecting the system -- with a trade-off of breadth vs speed.
If you need something more performant, use CRM_Utils_System::version(), e.g.
$ cv ...
8
votes
Accepted
CiviCRM integration with Eventbrite
You will need to create extension to have Eventbrite sync with CiviEvents. Here is some guideline on how to approach this
Create extension.
Add page using civix
In run() use CiviCRM api to create ...
7
votes
CiviCRM and Docker
No one on the core team is actively using docker, although a few of us experiment with it.
Several of us do use the civibuild command from https://buildkit.civicrm.org/ . It defines the reference/...
7
votes
Find CiviCRM version programmatically?
I'd use System.get API call. (source)
In the return values, there's a value for version which corresponds to the value in civicrm-version.php
$ cv api System.get name=version
{
"is_error": 0,
...
7
votes
ER diagram for the latest Civicrm , Foreign key in Structure, test cases/plans
I will answer your questions #1 and #2. (I'm not sure what you mean by #3. If #3 is sufficiently unrelated to #1 and #2, I would suggest creating a separate question for it)
Why an ER (Entity ...
7
votes
Within an extension how can load a custom `Civi` name-spaced class?
Add the following elements to your extension's info.xml file to enable PSR-4 autoloading:
<classloader>
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
Also see docs on the <...
7
votes
How to create a hook in an extension?
EDIT
This answer is now deprecated, you should use @bgm's answer instead, or for an alternative and possibly cleaner approach, try my other answer
All thanks to the code example link in Eric's answer ...
6
votes
How do I get more than 25 records from the API?
Adding options.limit to 0 returns the total result for the api which I feel is the best way to get more than 25 contacts :)
$params = array(
'version' => 3,
'sequential' => 1,
'...
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 ...
6
votes
Are there up-to-date CiviCRM coding standards available?
Using the Drupal standards in your IDE ought to get you most of the way. For fine-tuning you can see https://wiki.civicrm.org/confluence/display/CRMDOC/PHP+Code+and+Inline+Documentation and also try ...
6
votes
What does LExIM stand for?
LExIM is the new overall release and extension strategy:
LEAP BY EXTENSION. ITERATE BY MONTH.
It basically means that:
CiviCRM development will now happen mostly through extensions, ...
6
votes
Accepted
Fetch data over the web: curl, file_get_contents or something else?
CiviCRM core has bundled in Guzzle for a few years now (this was an old issue that got highlighted just now) - so Guzzle is the recommended approach
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() { ...
5
votes
Where to hire CiviCRM consultants or developers
You may want to have a look at CiviCRM's Partners and contributors page.
For special requirements, it would be helpful if you specify a bit more in detail, what you are looking for. Also, this CiviCRM ...
5
votes
Accepted
Using event listeners in my extensions
I have found why it was not working. I was looking in the user interface whether my tokens showed up in the list with tokens a user can use. But they did not. After digging all the core code I found ...
5
votes
Are there up-to-date CiviCRM coding standards available?
For IDE purposes, look at https://github.com/civicrm/coder/
This is a fork of drupal/coder which relaxes a number of conditions. (The coding practices in Civi differed from Drupal in some non-...
5
votes
Accepted
How do I make one hyperlink which shows its target page as a modal dialog when clicked?
It's quite simple actually. Add the css class crm-popup to the link and you're done :)
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
developer × 186extension × 45
api × 30
drupal × 14
hooks × 14
civicrm-buildkit × 11
civix × 11
angular × 11
civicontribute × 6
mysql × 6
civimail × 5
custom-fields × 5
upgrade × 5
payment-processor × 5
civievent × 4
civimember × 4
php × 4
javascript × 4
testing × 4
wordpress × 3
contacts × 3
civireport × 3
database × 3
relationships × 3
forms × 3