You are here

public function TransformerRulesManager::getRules in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 src/TransformerRulesManager.php \Drupal\fb_instant_articles\TransformerRulesManager::getRules()

Get the transformer rules.

Return value

array An array of rule definitions, where each rule definition is an associative array with the following keys:

  • class: Class name of the Rule, which should be a subclass of \Facebook\InstantArticles\Transformer\Rules\Rule
  • selector: String selector used to match elements in an HTML document to which apply the rule. Can be a simple element selector, a CSS selector or a XPath selector.
  • properties: Associative array or properties for the rules and how to get their values.

See also

https://developers.facebook.com/docs/instant-articles/sdk/transformer-rules

File

src/TransformerRulesManager.php, line 55

Class

TransformerRulesManager
Handles loading and altering of Transformer rules.

Namespace

Drupal\fb_instant_articles

Code

public function getRules() {
  $rules = $this
    ->defaultRules();
  $this->moduleHandler
    ->alter('fb_instant_articles_transformer_rules', $rules);
  return $rules;
}