This forum is for assistance with theme development.

Twig debugging problem

Hello,

I've read that to activate twig debugging you have copy development.services.yml to the default directory, rename it to local.services.yml, remove: 

parameters:
  http.response.debug_cacheability_headers: true

and add:

parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

at the end of the file.

theme install preprocess

is there a function that allows to do something whenever a theme is installed?

for example, I want to generate a content whenever a theme is installed.

D8 block twig configuration

I want to show the D8-based blocks in the block.html.twig file with the <aside> html tag only. However, when I entered this special split file, I created a special branch file for each block area (eg region--sagblok.html.twig), block title and content css, html codes. Unfortunately, the block titles did not appear.

print screen: 

http://s541.photobucket.com/user/veli3350/media/Ekran%20Grnts%202018-02-...

Sorry for my English.

Drupal 8 - sorting an array of nodes by custom field - uasort - ordering nodes - sortByWeight

I am trying to organise, an array called $nodes, by a field within the nodes called node_order.

$this->query = $this->query->condition($field, 'EXISTS')->sort($field, 'DESC');

But with no luck.

Now I am looking at:

uasort($nodes, ['Drupal\Component\Utility\SortArray', 'field_node_order.value', 'sortByWeightElement']);

Were can I set the Weight for these pages, as all the child pages are created using the same template type, so I need a way to assign weight to each node. 

Render preprocessor function HTML in page

In creating a custom theme I lost the edit page link admins see when they login and created this code:

// get node ID...
    function nosurprise_preprocess_html(&$variables) {
    $nid = $variables['result']['node']->nid;
    $node = node_load($nid);
  
  if(node_access('update',$node)){ print '<span style="font-size:12px;">'; print l( t('Edit Page'),'node/'.$node->nid.'/edit' ); print "</span>"; }
    }

How do I render the html produced by this line: 

Pages

Subscribe with RSS Subscribe to RSS - Theme development