upload and remove button in D8

Hi All,
I am tryng to write my first D8 code ... I have a file field type in a content type ... how can enable/disable remove_button in the form?
I tried using the hook_field_widget_form_alter() but I don't know how to get to the button element.
Someone has already handled this case ?
Many thanks!

[Solved] How to add a menu link to a menu programmatically?

I want to add a menu link to a menu programmatically. Here is my code

MenuLinkContent::create([
      'title' => 'Example link',
      'link' => ['uri' => 'internal:/node'],
      'menu_name' => 'main',
    ])->save();

But it gives me the following error

How to remove mymodule configurations on uninstall

I have created a custom module and created a yml file to create a menu

system.menu.custom_menu.yml

id: custom_menu
label: 'Custom menu'
description: 'Custom menu.'
langcode: en
locked: true
dependencies:
  - mymod

When I installed my module it creates the the custom menu. But then When I uninstall the module and try to install it again I get the following exception

Add a external css stylesheet drupal 8

I would like to add an external stylesheet (google font) via the template.libraries.yml file?

Here is the font:
<link href='https://fonts.googleapis.com/css?family=Great+Vibes' rel='stylesheet' type='text/css'>

I tried this with no luck.

google-font:
  version: VERSION
  remote: https://fonts.googleapis.com/css?family=Great+Vibes

Thanks for any help.

Drupal and Isomorphic JavaScript

The word is out. Headless Drupal with a REST API, is not the future. You're better off rendering your initial view on the server side. The wheel has been reinvented. This is called Isomorphic or Universal Javascript. The jury is still out on what title is the best. But Isomorphic JavaScript, introduced way back in 2013 by AirBNB and others holds some advantages... Drupal REST API and Isomorphic JavaScript

Entity one to many

Hi,

I was wondering: in Drupal8 when we create an entity we define basefielddefinitions. But is it also possible to define a field that holds multiple values?

ex: A user must indicate wich types of devices he has. There is a ContentEntity type devices to wich the field references. But possibly the user as more than one device.

I can't find how to do this in Drupal. The normal UML way would be to define an extra table that holds the relation to make that technically possible.

Matt.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 8.x