addTitle example

$bundles = $this->entityTypeBundleInfo->getBundleInfo($entity_type_id);
    // If the entity has bundle entities, the parameter might have been upcasted     // so fetch the raw parameter.     $bundle = $route_match->getRawParameter($bundle_parameter);
    if ((count($bundles) > 1) && isset($bundles[$bundle])) {
      return $this->t('Add @bundle', ['@bundle' => $bundles[$bundle]['label']]);
    }
    // If the entity supports bundles generally, but only has a single bundle,     // the bundle is probably something like 'Default' so that it preferable to     // use the entity type label.     else {
      return $this->addTitle($entity_type_id);
    }
  }

  /** * Provides a generic title callback for a single entity. * * @param \Drupal\Core\Routing\RouteMatchInterface $route_match * The route match. * @param \Drupal\Core\Entity\EntityInterface $_entity * (optional) An entity, passed in directly from the request attributes. * * @return string|null * The title for the entity view page, if an entity was found. */


    /** * Formats a log record. * * @param array $record A record to format * * @return mixed The formatted record */
    public function format(array $record)
    {
        $output = $this->addTitle($record['level_name']$record['level']);
        $output .= '<table cellspacing="1" width="100%">';

        $output .= $this->addRow('Message', (string) $record['message']);
        $output .= $this->addRow('Time', $record['datetime']->format('Y-m-d\TH:i:s.uO'));
        $output .= $this->addRow('Channel', $record['channel']);
        if ($record['context']) {
            $output .= $this->addRow('Context', $this->convertToString($record['context']));
        }
        if ($record['extra']) {
            if (\is_array($record['extra'])) {
                foreach ($record['extra'] as $key => $row) {
                    
Home | Imprint | This part of the site doesn't use cookies.