You are here

class BlogLister in Blog 3.x

Same name and namespace in other branches
  1. 8.2 src/BlogLister.php \Drupal\blog\BlogLister

Defines a blog lister.

Hierarchy

Expanded class hierarchy of BlogLister

1 string reference to 'BlogLister'
blog.services.yml in ./blog.services.yml
blog.services.yml
1 service uses BlogLister
blog.lister in ./blog.services.yml
Drupal\blog\BlogLister

File

src/BlogLister.php, line 13

Namespace

Drupal\blog
View source
class BlogLister implements BlogListerInterface {

  /**
   * Config Factory Service Object.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * The current user account.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $account;

  /**
   * Constructs a BlogLister object.
   */
  public function __construct(AccountInterface $account, ConfigFactoryInterface $config_factory) {
    $this->account = $account;
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   *
   * @param \Drupal\user\UserInterface $user
   *   User object.
   *
   * @return string
   *   Title string
   */
  public function userBlogTitle(UserInterface $user) {
    return new TranslatableMarkup("@username's blog", [
      '@username' => $user
        ->getDisplayName(),
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlogLister::$account protected property The current user account.
BlogLister::$configFactory protected property Config Factory Service Object.
BlogLister::userBlogTitle public function Overrides BlogListerInterface::userBlogTitle
BlogLister::__construct public function Constructs a BlogLister object.