Questions tagged [coding-standards]
The coding-standards tag has no usage guidance.
15
questions
3
votes
1
answer
62
views
api4: get(FALSE) vs get()->setCheckPermissions(FALSE): which is preferred?
In ap4, there are apparently two different ways to specify skipping permissions:
In the api4 browser at /civicrm/api4, when you un-check the "CheckPermissions" checkbox, the action method is ...
3
votes
1
answer
49
views
CiviCRM Individual Contact Inherits fields from Organisation
I am wondering is it possible to Copy fields from a Organisation Contact depending on relationship?
For e.g. If there is a relationship between Contact A and Contact B can Contact B inherit fields ...
3
votes
3
answers
152
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
0
answers
18
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
1
answer
35
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
3
answers
21k
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 ...
2
votes
1
answer
100
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
2
answers
145
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
1
answer
73
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 ...
3
votes
1
answer
49
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
3
answers
70
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
1
answer
34
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 ...
5
votes
2
answers
458
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
1
answer
103
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 ...
5
votes
2
answers
659
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 ...