Categories
CMS Drupal Mastering Development

How to create a term reference field programmatically

I need to add a taxonomy reference field to a node bundle, programmatically. I found a couple examples here, but one actually is incorrectly titled and is about creating a from field for it, and the other is from 2012. I have tried the following, based on the couple of suggested examples I found, and […]

Categories
Ask Games Video Games

Behavior Pack Not Working Minecraft Bedrock Edition

I am New to making addons and behavior packs, so I decided to make a simple behavior pack: Anything from fish is treasure. I made a manifest file, with a unique UUID, and some JSON files. I entered the game and it’s not working. I tried putting the files(except manifest) in another addon I have […]

Categories
Mastering Development

Why ajax passing null or 0 value to controller?

var newRecords = []; values: [ { “id”: 7, “name”: “Raddish”, “rate”: 30, “weight”: “5”, “amountperweight”: 150 }, { “id”: 8, “name”: “Peas”, “rate”: 35, “weight”: “6”, “amountperweight”: 210 } ] $.ajax({ method: “post”, url: “http://localhost:36551/Orders/GenerateOrder”, data: { “values”: newRecords }, dataType: “json”, success: function (response) { }, error: function (error) { } }); [HttpPost] […]

Categories
CMS Development Drupal

Why is my site status continuing to indicate mismatched field definitions after updating?

When I visit /admin/reports/status, I am told that a few entities have fields that need to be updated or reinstalled. I created an update hook: /** * Remove the result field from the analysis entity and reinstall */ function mymodule_update_8101(&$sandbox) { $entity_name = ‘analysis’; $old_field_name = ‘result’; $new_field_name = ‘result’; $field_definition = BaseFieldDefinition::create(‘decimal’) ->setLabel(t(‘Results’)) ->setDescription(t(‘Results.’)) […]

Categories
CMS Development Drupal

Custom form throws ‘Cannot unset string offsets’ error

I’m trying to build a form for my custom entity and so far the form is looking pretty good. However, when I press the Save button I get this error: The website encountered an unexpected error. Please try again later. Error: Cannot unset string offsets in Drupal\Core\Field\WidgetBase->extractFormValues() (line 367 of core/lib/Drupal/Core/Field/WidgetBase.php). Drupal\Core\Field\WidgetBase->extractFormValues(Object, Array, Object) (Line: […]

Categories
Development JSON

ngx-leaflet / GeoJson / Country Border

We are using Leaflet already on one of our site but now we are migrating to Angular. Now we are trying to reproduce it using Ngx-Leaflet. But we don’t have the country borders… What we have right now: In the component.html <div class=”col col-md-8″> <div style=”height: 700px; padding: 0; width: 100%;” leaflet [(leafletZoom)]=”leafletZoom” [(leafletCenter)]=”leafletCenter” [leafletMaxZoom]=”leafletMaxZoom” […]