Skip to content

Instantly share code, notes, and snippets.

View rmontero's full-sized avatar
🏠
Winning

Roberto Montero rmontero

🏠
Winning
View GitHub Profile
@rmontero
rmontero / d8_snippets.md
Created June 24, 2020 16:43 — forked from mgalang/d8_snippets.md
Drupal 8 snippets

Create link from text and url

$url = Url::fromRoute($route_name);
$link = Link::fromTextAndUrl($text, $url);

Create link from route

$link = Link::createFromRoute('Link Text', 'route_name')->getUrl();
@rmontero
rmontero / d8_snippets.md
Created June 24, 2020 16:43 — forked from mgalang/d8_snippets.md
Drupal 8 snippets

Create link from text and url

$url = Url::fromRoute($route_name);
$link = Link::fromTextAndUrl($text, $url);

Create link from route

$link = Link::createFromRoute('Link Text', 'route_name')->getUrl();
@rmontero
rmontero / 1.dynamic-links-action.md
Created June 24, 2020 16:42 — forked from vijaycs85/1.dynamic-links-action.md
Drupal 8 snippets for different functionality
<?php
function peer_review_install() {
drupal_install_schema('peer_review');
}
function peer_review_uninstall() {
drupal_uninstall_schema('peer_review');
}
@rmontero
rmontero / cod_session.module
Created July 30, 2012 21:53
$form['field_session_room']['#type'] = 'nodereference_select';
// cod_session.module @ 161
// If this is content-type is not unique make the widget a select list.
if (variable_get('cod_unique_' . $form['#node']->type, COD_SCHEDULE_SINGLE) == COD_SCHEDULE_MULTIPLE) {
$form['field_session_room']['#type'] = 'nodereference_select';
// Keep the widget from allowing multiple values.
$form['#field_info']['field_session_room']['multiple'] = FALSE;
}