Skip to main content
Drupal Dev

Main navigation

  • Home
  • Users
  • Demo: Events
User account menu
  • Registrati
  • Log in
By admin, 13 November, 2020

Ottenere il parametro dall'URL in drupal 8

Breve snippet che mostra come ottenere i parametri dell'URL in drupal 8. Dove in drupal 7 dovresti fare un po 'di $ _GET o lavorare con args (0), ora hai una funzione pulita per farlo.

// example.com?tag=1
$tag = \Drupal::request()->query->get('tag'); 

// Then you can proceed with 
if($tag) {
...

Tags

  • Parameter
By admin, 21 July, 2020

Installare una determinata versione di Drupal con il composer

Se volessimo installare una versione tipo Drupal 8.8.0 basta lanciare questo comando da terminale

composer create-project drupal/recommended-project:8.8 [Nome della direcotry]

Tags

  • drupal8
  • composer
  • Installazione
By admin, 1 March, 2020

Abilitare ambiente di Debug su Drupal 8

Per lavorare in local senza dover effettuare il flush della cache continuamente, inserire in /sites/default

il seguente file "settings.local.php"

Tags

  • Debug
By admin, 10 September, 2019

Creazione Pagina off-line per evitare il messaggio di errore del DB

Per evitare la famosa pagina di errore del DB quando il sito è offline, basta abilitare nel file settings.php la configurazione che permette a drupal di determinare la posizione della pagina.

# $conf['maintenance_theme'] = 'bartik';

 

Tags

  • Maintenance page
  • Pagina errore
  • database error
By s.catroppa, 12 August, 2019

Abilitare debug temi -> Leggi facilmente il nome del tpl

$conf['theme_debug'] = TRUE;

È sufficiente aggiungere questa riga di codice al file settings.php, cancellare la cache e poi nel sorgente delle varie pagine appare il nome consigliato per il tpl.
 

Tags

  • theme debug tpl
By s.catroppa, 24 July, 2019

Salvare variabile da un dropdown in un form

$form['protocol_value'] = array(
'#title' => t('Protocol'),
'#type' => 'select',
'#description' => 'Select the protocol to be used (HTTP or HTTPS)',
    '#default_value' => variable_get('protocol_value', 'http://'),
'#options' => array(t('http://'), t('https://')),
);

 

Tags

  • moduli
  • dropdown
  • select
  • variable_get
By admin, 21 February, 2019

Cambiare titolo in Node Edit content type

Cercare o inserire la funzione _form_alter nel template.php

**
* Implementation of hook_form_alter()
*/
function [THME_NAME]_form_alter(&$form, &$form_state, $form_id) {   
    if ('id_card_node_form' == $form_id) {
     // Change title of Edit add page
     drupal_set_title(t('Add content XXXX'));
    }
    return $form;
}
 

Tags

  • Title
  • Edit
  • Node
By admin, 13 November, 2018

Personalizzare il main menu

Inserire questo cosice nel file template.php del proprio tema.

Tags

  • Menu
By admin, 9 November, 2018

Personalizzazione del Tema con Theme-settings.php

Aggiunta di setting nella sezione del tema.

Inserimento di una nuova area nel settingdel tema. Creare il file theme-settings.php nella cartella del proprio tema.

 

Esempio: Inserimento e attivazione di una regione Testimonials del tema chiamato ARCADIA

Tags

  • Custom Theme
  • Settings Theme
By Morzilla, 19 October, 2018

Dichiarare una Variabile Globale

Dichiarare una variabile globale in un modulo

    ... 
    use GuzzleHttp\Exception\ClientException;
    ... 

    global $nomevar;
    $nomevar = "valore";

	class NomeClasse { 
       public function nomeFunzione() { 
           global $nomevar; 
           ...

Tags

  • global variable
  • global
  • php
  • symphony

Pagination

  • First page
  • Previous page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Page 6
  • Page 7
  • Next page
  • Last page

TagCloud

Twig(7) Template(6) composer(5) Debug(4) CSS(4) Embed(4) Views(4) php(3) Taxonomy(3) Image Style(3) form(3) redirect(3) drupal8(3) Edit(3) Node(3) Block(3) Parameter(2) Custom Theme(2) Expose Filter(2) Fields(2) User(2) Profile(2) Field image(2) drush(2) cache(2) moduli(2) Grafica(2) Bootstrap 3(2) URL(2) Social Share(2) OG Group(2) Custom (1)node.html.twig (1)php8 (1)controller (1)Alias (1)Path (1)Node Reference (1)Prev/Next (1)Installazione (1)database error (1)Pagina errore (1)Maintenance page (1)theme debug tpl (1)variable_get (1)select (1)dropdown (1)Title (1)Menu (1)Settings Theme (1)symphony (1)global (1)global variable (1)widget (1)responsive (1)Youtube (1)Tree (1)Sub-category (1)Category (1)tag HTML (1)Webform (1)console (1)dev (1)Style (1)Images (1)Pictures (1)Search form (1)gestione stringhe (1)truncate (1)stile immagine (1)link immagine (1)tassonomia (1)bug-fixing (1)diff (1)patch (1)Core (1)hook (1)yml (1)libreria (1)js (1)tema (1)comandi (1)hostname (1)entity (1)ruoli (1)rules (1)login (1)RUBY (1)Compiler (1)SASS (1)SCSS (1)Field embed (1)Grid (1)Logfile watchdog (1)Breadcramb (1)Table (1)Contact form (1)Date (1)
RSS feed