Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info.xml - Allow extensions to define a list of tags #16551

Merged
merged 1 commit into from
Feb 15, 2020

Conversation

totten
Copy link
Member

@totten totten commented Feb 15, 2020

Overview

This adopts a convention by which extensions may use info.xml to register tags, e.g.

<extension key="org.civicrm.foo" type="module">
  <tags>
    <tag>civicontribute</tag>
    <tag>payment-processor</tag>
    <tag>install-mandatory</tag>
  </tags>
</extension>

Before

To add any metadata to info.xml files, you must update the parser and provide filtering/indexing logic.

After

If you need to add very simple metadata (tags), you can do that without extra parsing code. The tag information can be accessed in the following ways:

  • Using the extension mapper
    $mapper = CRM_Extension_System::singleton()->getMapper();
    $allTags = $mapper->getAllTags();
    $mandatoryExts = $mapper->getKeysByTag('install-mandatory');
  • The Extension.get API will return the list of tags for each ext

Overview
--------

This adopts a convention by which extensions may use `info.xml` to register tags, e.g.

```xml
<extension key="org.civicrm.foo" type="module">
  <tags>
    <tag>civicontribute</tag>
    <tag>payment-processor</tag>
    <tag>install-mandatory</tag>
  </tags>
</extension>
```

Before
------

To add *any* metadata to `info.xml` files, you must update the parser and providing
filtering/indexing.

After
-----

If you need to add very simple metadata (tags), you can do that without
extra parsing code.  The tag information can be accessed in the following
ways:

* Using the extension mapper
    ```php
    $mapper = CRM_Extension_System::singleton()->getMapper();
    $allTags = $mapper->getAllTags();
    $mandatoryExts = $mapper->getKeysByTag('install-mandatory');
    ```
* The `Extension.get` API will return the list of tags for each ext
@civibot
Copy link

civibot bot commented Feb 15, 2020

(Standard links)

@eileenmcnaughton
Copy link
Contributor

I guess my question is - about control - this makes it easy to add new tags - for better and worse. We don't have to change the code to define a new tag - but is there a control aspect to 'free-tagging' - or do we not care what tags people give, as long as they don't expect anything other than documented ones to trigger functionality.

It feels like once this is merged I can go back through my extensions & give them 'helpful' tags. But it also feels like the goal is that I tag my payment processors with 'payment-processor' not paymentProcessor' or 'payment_processor' to support some future UI along the lines of what John FF did

@eileenmcnaughton
Copy link
Contributor

@twomice pinging you in as extension lead

@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Feb 15, 2020

@seamuslee001 @colemanw @mlutfy @MikeyMJCO ping

@eileenmcnaughton eileenmcnaughton added the merge ready PR will be merged after a few days if there are no objections label Feb 15, 2020
@homotechsual
Copy link
Contributor

I would say "needs documentation" in line with your first comment above regarding what it's intended use is - if there are tags that do certain special things they should be documented. Otherwise it looks ok to me.

@twomice
Copy link
Contributor

twomice commented Feb 15, 2020

+1 for "needs documentation". Devs will benefit from knowing what's expected, supported, and allowed WRT extension tags.

I'm not sure how much this has been discussed so far. Is there somewhere a proposed list of supported tags, and perhaps even a proposed format for tags (contribute vs civiContribute vs civicrm_contribution, etc.)?

@MegaphoneJon
Copy link
Contributor

I've been thinking about a similar idea for a while - especially because there are many extensions that are popular for building on top of (CiviRules, CiviToken, and Extended Reports off the top of my head). However, there isn't a UI for discovering new rules/tokens/etc. Tagging with "Provides CiviRule action" would enable this.

Most of the tags I would actually want/use focus on the feature they extend - "soft credits", "contribution pages", "PCPs" etc. In some ways, there's a question of whether there's a taxonomy that's more granular than the Civi components that makes sense for talking about Civi as a whole.

@eileenmcnaughton
Copy link
Contributor

I'm going to merge this since I think this concept has agreement & Ill take the docs conversation to the docs queue

@eileenmcnaughton
Copy link
Contributor

Docs PR is civicrm/civicrm-dev-docs#761

@totten totten deleted the master-ext-tags branch February 17, 2020 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants