This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Drupal 8 list. | |
* A render array element that lives inside a build() method | |
* e.g. inside of a class that extends BlockBase. | |
*/ | |
$items = []; | |
$items[] = 'one'; | |
$items[] = 'two'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Autoload Url and Link classes. | |
use Drupal\Core\Url; | |
use Drupal\Core\Link; | |
/** | |
* External link | |
*/ | |
$url = Url::fromUri('https://colorfield.be'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name drupal8.dev; # domain name, separate aliases by a space | |
root /path/to/site/drupal8-dev; # directory of the site (document root) | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move all files from the current directory in the parent directory | |
mv * .[^.]* .. | |
# chmod all the files only | |
find . -type f -exec chmod 655 {} + | |
# Delete files containing a pattern on the name | |
find my_dir -name ._\* -delete | |
# Find and update all occurrences of a file with a file as input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// place this in a global script like settings.php in Drupal | |
ini_set("display_errors", 1); | |
ini_set("track_errors", 1); | |
ini_set("html_errors", 1); | |
error_reporting(E_ALL); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Drupal 7 | |
*/ | |
$fid = 1; | |
$uri = file_load($fid)->uri; // or fetched via the uri property of a field | |
$image_url = image_style_url('thumbnail', $uri); | |
$image = theme_image(array( | |
'path' => $image_url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Drupal\Core\Url; | |
class BatchProcessController extends ControllerBase | |
{ | |
const OPERATION_CREATE = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Drupal\node\Entity\Node; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Drupal\Core\Entity\EntityTypeManager; | |
use Drupal\Core\Entity\Query\QueryFactory; | |
use Drupal\Core\Render\Renderer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\rest_import\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Drupal\Core\Entity\Query\QueryFactory; | |
use Drupal\Core\Entity\EntityTypeManager; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '../variables.css'; | |
@import '../Page/Page.css'; | |
ul { | |
list-style-type: none; | |
padding-left: 0; | |
} | |
li { | |
margin-bottom: 30px; |
OlderNewer