What is the correct expression of "legendInterface()" in qgis3.0? I tried with "layerTreeNode", but it doesn't work.
root = QgsProject.instance().layerTreeRoot()
for group in [child for child in root.children() if child.nodeType() == 0]:
if group=="POSTE_DETENTE":
group_actif = root.findGroup(group)
#now, I would iterate on layers in the list L in order to get the polygon layers
for (type, sys, champ, name) in L:
#get the polygon layer
if type=='polygon':
#create_layer is a function that I create previously and return a new layer in memory
layer=create_layer(type, sys, champ, name):
# add layer to the legend
QgsProject.instance().addMapLayer(layer, False)
# add layer to the group - False to let the choice where to place the layer in the group
group_actif.addLayer(layer)