Install fluent
Last updated on
18 August 2022
To install fluent you need to use composer in your root project directory
$ composer req drupal/fluentEnable module
$ drush en fluentHow to use it
Fluent via global function
<?php
function hook_pre_process_something() {
$linkTitle = using($paragraph)->value('field_link.title');
}Inject via dependency injection
<?php
use Drupal\fluent\Fluent;
class MyClass {
public function __construct(Fluent $fluent) {
$this->fluent = $fluent;
}
public function methodUsingFluent() {
$node = Node::load(1);
$title = $this->fluent->using($node)->value('title');
// ...
}
}
services:
class: MyClass
arguments:
- '@fluent.service'
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion