You are here

private function MandrillTemplateMapForm::parseTemplateRegions in Mandrill 8

Parses a Mandrill template to extract its regions.

1 call to MandrillTemplateMapForm::parseTemplateRegions()
MandrillTemplateMapForm::form in modules/mandrill_template/src/Form/MandrillTemplateMapForm.php
Gets the actual form array to be built.

File

modules/mandrill_template/src/Form/MandrillTemplateMapForm.php, line 183
Contains \Drupal\mandrill_template\Form\MandrillTemplateMapForm.

Class

MandrillTemplateMapForm
Form controller for the MandrillTemplateMap entity edit form.

Namespace

Drupal\mandrill_template\Form

Code

private function parseTemplateRegions($html, $tag = 'mc:edit') {
  $instances = array();
  $offset = 0;
  $inst = NULL;
  while ($offset = strpos($html, $tag, $offset)) {
    $start = 1 + strpos($html, '"', $offset);
    $length = strpos($html, '"', $start) - $start;
    $inst = substr($html, $start, $length);
    $instances[$inst] = $inst;
    $offset = $start + $length;
  }
  return $instances;
}