You are here

protected function AutoEntityLabelManager::evalLabel in Automatic Entity Label 8

Same name and namespace in other branches
  1. 8.2 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::evalLabel()

Evaluates php code and passes the entity to it.

@codingStandardsIgnoreStart

Parameters

string $code: PHP code to evaluate.

\Drupal\Core\Entity\ContentEntityInterface $entity: Content entity to pa ss through to the PHP script.

Return value

string String to use as label.

1 call to AutoEntityLabelManager::evalLabel()
AutoEntityLabelManager::generateLabel in src/AutoEntityLabelManager.php
Generates the label according to the settings.

File

src/AutoEntityLabelManager.php, line 309

Class

AutoEntityLabelManager
AutoEntityLabelManager class.

Namespace

Drupal\auto_entitylabel

Code

protected function evalLabel($code, $entity) {
  ob_start();
  print eval('?>' . $code);

  // @codingStandardsIgnoreEnd
  $output = ob_get_contents();
  ob_end_clean();
  return $output;
}