Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [coding-standards]

The tag has no usage guidance.

1
vote
3answers
20 views

Should I use Civi::settings()->get and set or

In this post on StackExchange How do I add a new settings page for my extension? the way to create settings in CiviCRM is stated as : Create a settings dir in your extension's base directory, and ...
1
vote
0answers
12 views

Which javascript features can I use in CiviCRM core?

Does CiviCRM have an agreed-upon browser version to target for javascript features? For example: Can I use Object.create() (IE 9+)? Can I use 'use strict'; (IE 10+)? Can I use let (IE 11+)? Can I ...
1
vote
1answer
22 views

Why is the entity.action permission sparse?

I've recently been exploring the $permissions array that drives API actions and extracted the metadata from the logic to allow displaying as a nice table. The CRM_Utils_Hook::alterAPIPermissions($...
5
votes
3answers
5k views

how do I use phpcbf?

When I run civilint in the build kit I get a long report which ends with this line: PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY Well that sounds great! Where is this mythical phpcbf ...
3
votes
1answer
76 views

BAO vs API layer

I'm started to look at both the API and BAO classes. It seems there is a degree of scope overlap for the business logic. It seems to me that most logic should live in the BAO - but am I missing ...
5
votes
2answers
90 views

How much symfony do I need to learn if I am going to be a CiviCRM core hacker?

I'm bit of a CiviCRM noob, but I'd like to help out and fit with the current patterns. I keep encountering bits of Symfony in core code and it seems well respected... and pretty cool. So far I have ...
3
votes
1answer
49 views

Smarty and future proof code

I am trying to be a more conforming civicrm coder. Smarty used by civicrm for pages (and forms?) I have never used Smarty.. Is it going to be part of civicrm going forward? And are there any tips ...
4
votes
1answer
41 views

What are the core functions an extension can rely on?

It's been said, quite reasonably, that all APIs should have tests, and that if a feature doesn't have tests then coders shouldn't rely on it. This raises two three questions: other than direct "API3"...
1
vote
3answers
48 views

best practice for using core base functions (CRM_Utils_System_Base) from an extension?

CRM_Utils_System_Base defines a great set of key functions that look like they should work in any system. What is the correct way to access this functionality within an extension? FYI these are the ...
3
votes
1answer
27 views

private or protected class properties

I'm looking at a class in CRM_Utils_Cache here specificly and it looks exactly like what I need to write some unit tests against my extension. The issue is that the $cache array is private rather ...
6
votes
2answers
285 views

Class naming and namespaces: best practice as an extension author?

Noting these related questions (1 2 3) and these two wiki pages (1 2) and the psr-0 standard, I remain a bit lost about current best practice in CiviCRM extensions! So if I have an extenstion org....
9
votes
1answer
84 views

What versions of PHP are used in CiviCRM's internal QA?

The wiki currently states that CiviCRM has bare minimum (5.3.10) and recommended (>= 5.4) PHP requirements. Knowing what CiviCRM has been tested with can help identify what should be expected to work ...
6
votes
2answers
548 views

What is the recommended level of PHP for CiviCRM? There seems to be some inconsistencies

See the wiki which says the minimum level is 5.4+ But see this linked page from the wiki which recommends 5.6 with a bare minimum of 5.3.10. See also the system status for release 4.7 which says ...