public function Generator::links in Style Guide 8
Same name and namespace in other branches
- 2.x src/Generator.php \Drupal\styleguide\Generator::links()
Generate a array of random links.
Parameters
string $url: The internal path or external URL being linked to.
int $size: The total number of links to generate .
Return value
array A array of random links
Overrides GeneratorInterface::links
File
- src/
Generator.php, line 214
Class
- Generator
- Class Generator.
Namespace
Drupal\styleguideCode
public function links($url, $size = 4) {
$links = [];
for ($i = 0; $i < 5; $i++) {
$links[] = [
'title' => $this
->words(3),
'url' => Url::fromUserInput($url),
];
}
return $links;
}