How do I remove the title field from a node’s custom view mode

In my Drupal 8 website I created a custom view mode through the UI. I use it to output nodes using a view.

In the view result I do not want the titles of the nodes to appear. The UI (content type > manage display) does not seem to give the option to hide the title.

How can I hide the title in a specific view mode for an entity via the UI or via custom code?

Programmatically Importing Nodes from one page to another another

I want to import node that are on one page to another programmatically.

Have tried to do by two method

$ my_view_name = ‘view name’; $ my_display_name = ‘display name’;

$ my_view = views_get_view($ my_view_name); if ( is_object($ my_view) ) { $ my_view->set_display($ my_display_name); $ my_view->$ nid; return $ my_view

views_embed_view(‘Machine name’, ‘Page name’, $ nid);

I want to grab all the nodes from one page and with the same node want to do some operations on another page.

Directed graph that returns before all its child nodes are visited?

Give an example of a directed graph in which a depth-first search backs up from a vertex $ v$ before all the vertices that can be reached from $ v$ via one or more edges are discovered.

My professor recently asked this question as a warm up to lecture, but never answered it. I still have not figure how that is possible. Why would it return if it’s not complete?

I just can’t see a scenario where this would happen.

It would never return, since DFS is (essentially) recursive and it can’t return without having hit all base cases.

Bitcoin economic nodes, concensus, and historical nodes

With regards to the recent dos + inflation bug, and seeing that most nodes on the network have still not upgraded with the patch (lukedashjr’s chart here:, I think the least understood aspect of Bitcoin to me is this idea of economic majority. Can you someone elaborate on the economic majority? Suppose in a scenario, I have a node running following the rules of Bitcoin Core v0.17.0 and if I die, but I still want those rules to be enforced, can I do that? Do ancestor nodes have any consensus role to play or only the ones being used today (“economic” nodes, i.e. exchanges, miners, merchants) matter?

How to “always relate” nodes to group – D8

In OG in D7, there was a field that was set to say this node belongs to group x.

With the Group module in D8, if a user creates a node through the normal /node/add/page link, it will not be linked to a group without later going in to relate that node to the group. I want the users to be adding content that directly belongs to the group and not outside of it. This is for the purpose of content moderation rules inside of the groups.

Need to edit links in hundreds of nodes – can it be done via a module?

I have a number of nodes of a content type in which the body contains links using These links no longer resolve due to domain name changes to the original link that was ‘bitlyed’.

I’ve been correcting these manually:

  • Find all nodes of type news with link in body
  • Foreach node,
  • View node
  • Click on link
  • Edit url in browser so that it resolves to file (pdfs)
  • Download file to local
  • In Drupal, upload file via Content->Add Media->File
  • Edit body in node to replace link with link to file on Drupal instance
  • Save edits
  • Next node

There are a goodly number of nodes to do this to; I also have a number of instances where the link is not, but is to a domain that will be retired.

To me, this just screams for automation, but I know I need to do it via Drupal as much as possible.

Is this worth undertaking creating a module? Or is there another way that’s advised?

Any help will be appreciated.

Problem attaching files to nodes with Services

I’m trying to attach files (images) to nodes via Services 3 from an external app using JavaScript.

From what I understand (and doing) is:

1) Create a node posting JSON to my endpoint

{   "type":"foo",   "title":"Hello World",   "language":"und",   "body":{"und":{"0":{"value":"Body Text"}}}, } 

2) Create file posting JSON to my endpoint

{   "filename":"image.jpg",   "target_uri":"public://image.jpg",   "filemime":"image/jpeg",   "file":"myBase64String" } 

No problem at all at this point.

Then when trying to attach the files created to the node, is where I have trouble, not http errors, simply nothing happens.

First I have tried posting JSON to my endpoint*nid/attach_file after successfully creating a new file, and getting back the fid

{   "field_name":"foo",   "filename":"image.jpg",   "fid":"*fid" } 

Returning Status 200 OK empty text, but when viewing the node remains the same without the file attached.

I have also tried to create the files first and then when posting for node creation adding the fid, the node is created but no file attached.

{   "type":"foo",   "title":"Hello World",   "language":"und",   "body":{"und":{"0":{"value":"Body Text"}}},   "field_foo":{"und":{"0":{"fid":"*fid"}}} } 

My field is a field type Image, widget Image. I have also tried in another field type file, with same results.

If someone can give me a heads up, what am I doing wrong or what is missing. I can’t find any explanatory documentation on line.

Thank you.

Finding nodes that have not been indexed

On a Drupal 8 website I’m administering the ratio of paged indexed by search_cron stays at a value far below 100%.

New pages are indexed, but it looks as if updated pages are not indexed again. I suspect that there is some problem that keeps nodes from being (re-)indexed. Howerver, I see no error in the log. Search_cron takes very long – several minutes even when indexing only 20 pages per cron run.

There is a page Troubleshooting cron which contains a SQL query (under “Check for problems with modules”) to find nodes that haven’t been indexed so one can inspect them for bad content. Unfortunately, this works only with Drupal 7, and I couldn’t find a similar page for Drupal 8.

How can I find non-indexed nodes on Drupal 8?

Extracting attribute value from multiple XML nodes in golang?

I’m attempting to parse an SVG file to get all of the colors that are present in the file. SVGs are XML based and their structure can vary a bit. For example:

<svg viewBox="-80 -80 160 160">   <g stroke="black" fill="none">     <path d='...' fill='#0FF'/>     <path d='...' fill='#F0F'/>     ...   </g> </svg> 


<svg viewBox="0 0 100 100">   <a>     <path d="..." stroke="black" fill="red"/>     <ellipse stroke="black" fill="white" cx="50" cy="40" rx="22" ry="35"/>     <circle cx="50" cy="40" r="5" stroke="black" fill="red"/>   </a> </svg> 


<svg viewBox="0 0 80 120">   <rect id="background-rect" x="0%" y="0%" width="100%" height="100%" fill="#aaaaaa"/> </svg> 

Are all examples of valid SVGs. At first I attempted to create the underlying structs that would allow me to represent all of these structures but then I decided to take a more generic approach that would focus soley on the fill attribute which is all I care about:

type GenericNode struct {     XMLName xml.Name     Fill    string        `xml:"fill,attr"`     Nodes   []GenericNode `xml:",any"` }  func (s *SVGController) GetColorsFromXML() []string {     xmlFile, _ := os.Open(s.Path)     byteValue, _ := ioutil.ReadAll(xmlFile)     var svg GenericNode     xml.Unmarshal(byteValue, &svg)      // Using a map here to avoid having to worry about having     // duplicate colors in the color slice     colorMap := make(map[string]struct{})     colorMap = getSVGColors(svg, colorMap)      // Once we have a complete color map extract all the keys     // to an array and return it.     colors := make([]string, len(colorMap))     i := 0     for k := range colorMap {         colors[i] = k         i++     }     return colors }  func getSVGColors(svg GenericNode, colors map[string]struct{}) map[string]struct{} {     if svg.Fill != "" && strings.ToLower(svg.Fill) != "none" {         colors[svg.Fill] = struct{}{}     }     for _, node := range svg.Nodes {         colors = getSVGColors(node, colors)     }     return colors } 

Is this a reasonable approach to take? Am I doing anything here that should be avoided?