You are here

protected function AutoEntityLabelManager::evalLabel in Automatic Entity Label 8.2

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

Evaluates php code and passes the entity to it.

Parameters

string $code: PHP code to evaluate.

object $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 335

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

Namespace

Drupal\auto_entitylabel

Code

protected function evalLabel($code, $entity) {
  ob_start();

  // @codingStandardsIgnoreLine
  print eval('?>' . $code);
  $output = ob_get_contents();
  ob_end_clean();
  return $output;
}