How does a monk’s Martial Arts feature modify damage done by magical monk weapons?

I’m curious about how exactly the Martial Arts class feature modifies damage done with magic weapons that add extra damage. Here’s the relevant bullet point of the class feature (which is on page 78 of the PHB, and in the basic rules).

  • You can roll a d4 in place of the normal damage of your unarmed strike or monk weapon. This die changes as you gain monk levels, as shown in the Martial Arts column of the Monk table.

The kind of scenario I’m curious about is a 10th level monk (Martial Arts die: 1d8) wielding a Frost Brand. Here’s the relevant part of the rules for the weapon (from page 171 of the DMG, and in the basic rules):

Frost Brand

Weapon (any sword), very rare (requires attunement)

When you hit with an attack using this magic sword, the target takes an extra 1d6 cold damage. […]

A shortsword version of a Frost Brand is a valid monk weapon, and it does 1d6 piercing damage as well as the additional 1d6 cold damage described in the quote. If our monk was attacking with it and wanted to use Martial Arts, which dice would be replaced? Just the base die for the weapon, or both dice? If both dice would be replaced, what damage type would the 1d8 damage be?

Does Martial Arts replace non-dice based damage modifiers? Would a Shortsword +1 do 1d8+1 damage, or just 1d8? Would Martial Arts replace the extra +7 damage you’d get when a Mace of Smiting gets a crit? Obviously for a lot of weapons, switching out the damage may be a bad idea, but its unclear if you can just swap the base damage die and still keep the additional magical damage.

(This topic came up in discussion of a question I asked about a homebrew tweak to a monk subclass. I realized I don’t actually know how the rules-as-written work, which makes it a bit trickier to homebrew!)

Modify string that stored in clipborad depending on random value

I wrote simple program, that will make string ‘noisy’ if clipboard contains one. What disappoints me, that i should manually check what i got from getClipboardString — in the Nothing case we just simply returning from program, otherwise we modifying string. Is there a better way to do this kind of check?

import Data.Char (toUpper) import System.Random (randomIO) import System.Clipboard (setClipboardString, getClipboardString) import Control.Monad (join)  main :: IO () main = do   join $   fmap (test doNoise) getClipboardString  where  test :: (String -> IO ()) -> (Maybe String) -> IO ()  test _ Nothing = return ()  test f (Just s) = f s   doNoise :: String -> IO ()  doNoise s = do   capsed <- (sequence $   map randCap s)   setClipboardString capsed   randCap :: Char -> IO Char  randCap x = fmap ($   x) $   fmap choice (randomIO :: IO Bool)   choice :: Bool -> (Char -> Char)  choice x = if x then toUpper else id 

How to modify a form to have some field surrounded by ‘Details’?

I created a custom content entity with Drupal Console.
Three of its fields are defined this way:

// ----------------------------------------------------------------------------     $  weight++;     $  fields['picture'] = BaseFieldDefinition::create('image')       ->setLabel(t('Picture'))       ->setSettings([         'file_extensions' => 'gif jpeg jpg png',         'file_directory' => 'sel',         'alt_field_required' => 0,       ])       ->setCardinality(3)       ->setDisplayOptions('view', [         'type' => 'default',         'weight' => $  weight,       ])       ->setDisplayOptions('form', [         'type' => 'image_image',         'weight' => $  weight,       ])       ->setDisplayConfigurable('form', TRUE)       ->setDisplayConfigurable('view', TRUE); // ----------------------------------------------------------------------------     $  weight++;     $  fields['file'] = BaseFieldDefinition::create('file')       ->setLabel(t('File'))       ->setSettings([         'file_extensions' => 'pdf',         'file_directory' => 'sel',         'description_field' => TRUE,       ])       ->setDisplayOptions('view', [         'type' => 'file',         'weight' => $  weight,       ])       ->setDisplayOptions('form', [         'type' => 'file',         'weight' => $  weight,       ])       ->setDisplayConfigurable('form', TRUE)       ->setDisplayConfigurable('view', TRUE); // ----------------------------------------------------------------------------     $  weight++;     $  fields['link'] = BaseFieldDefinition::create('link')       ->setLabel(t('Link'))       ->setDisplayOptions('view', [         'type' => 'link',         'weight' => $  weight,       ])       ->setDisplayOptions('form', [         'type' => 'link_default',         'weight' => $  weight,       ])       ->setDisplayConfigurable('form', TRUE)       ->setDisplayConfigurable('view', TRUE); // ---------------------------------------------------------------------------- 

And the corresponding form looks like this:
enter image description here
I would like to have the ‘file’ and the ‘link’ field in something like the ‘Picture’ field…
I updated buildForm :

public function buildForm(array $  form, FormStateInterface $  form_state)   {     $  form = parent::buildForm($  form, $  form_state);     $  entity = $  this->entity;     $  form['link']['widget']['0']['#type'] = 'details';     return $  form;   } 

And I got this:
enter image description here

How can I do the same for the ‘File’ field (have it surrounded in some ‘Details’)?

terraform: modify lb listener

I have a terraform script where I use a module dcos-terraform/dcos/aws to setup my infra, I then make certain modifications like route52 rules and load balancer certificates etc. I am trying to modify the NLB 443 protocol to TLS from TCP with a certificate, but terraform tries to create a new one instead and fails.

... # i get the load balancer, target group and listeners data "aws_lb" "ext-lb" {   name = "ext-$  {var.cluster_name}" } data "aws_lb_target_group" "ext-tg-443" {   name     = "ext-$  {var.cluster_name}-tg-443" } data "aws_lb_listener" "public-front_end" {   load_balancer_arn = "$  {data.aws_lb.ext-lb.arn}"   port = "443" }  # i then need to modify the listener but throws Suplicate port error as it tries to make a new one instead of modifying it. resource "aws_lb_listener" "public-front_end" {   load_balancer_arn = "$  {data.aws_lb.ext-lb.arn}"   port              = "443"   protocol          = "TLS"   ssl_policy        = "ELBSecurityPolicy-2016-08"   certificate_arn   = "$  {aws_acm_certificate.cert.arn}"    default_action {     type             = "forward"     target_group_arn = "$  {data.aws_lb_target_group.ext-tg-443.arn}"   } }  # i also tried this, but it requires the port to already be TLS and not TCP resource "aws_lb_listener_certificate" "public-certificate" {   listener_arn    = "$  {data.aws_lb_listener.public-front_end.arn}"   certificate_arn = "$  {aws_acm_certificate.cert.arn}" }  ... 

How can I see exactly what arguments are being passed through a filter so that I may modify them?

I’m having a great deal of trouble phrasing this.

If I were to use the filter

views_edit-page 

How can I see what exactly is being passed through the filter so that I may edit them? Normally I would var_dump something similar to this, to get a breakdown of it’s contents, but due to it being a filter, this does not seem to work.

For example

add_filter('views_edit-page','addFilter');  function addFilter($  views) {   var_dump($  views);   die(); } 

Is what I’d like to do, so that I may see exactly what $ views consists of, in order to edit them. However, this does not work, what is a method I can use in order to see the content of $ views?

How to modify the / home location?

Recently I reinstalled ubuntu and created two partitions. The whole system was on an SSD and / home was inside the other partition, in HD. However, I wanted the / home to stay on the SSD and the HD to be a second / home, just for files. Can someone help me?

NOTE: I can not deallocate memory from /home on HD if i have the risk of losing my files. If possible I wanted to create a / home on the SSD and rename the old / home so there is no conflict in the system.

How to automatically modify a field after saving content?

I have posted this question on drupal.org (via a comment titled “field modification triggered by saving action“), but I realized that the thread is more than five years old. So I reproduce here the question made there:

field modification triggered by saving action

I need to modify a field, but this change has to be triggered when saving the term and it depends on the value of another field, let me explain …

term

  • field 1: filled with options A/B/C
  • field 2: <info>random_name

I save and if value in

  • Field 1 is A, then value in Field 2 must change to “Source: random_name”

  • Field 1 is B, then value in Field 2 must change to “Destination: random_name”

  • Field 1 is C, then value in Field 2 must change to “Product: random_name”

Note that the label <info> is the one that must change.

Modify token used in path URL alias generation

We would like to have the URL pattern for Article content type to use article/[node:field_short_description]. In the scenario where field_short_description is not populated, we would like for the URL pattern to be article/[node:title] as a fallback.

Questions

  1. Is it possible to use the field_short_description field if populated, else use the title field without custom code?
  2. How would we do this without custom code?

We tried to use article/[node:field_short_description]|[node:title] but when both fields are populated, then both are added to the URL.