Skip to main content
Tweeted twitter.com/StackDrupal/status/1015292554013704192
added a more specific question
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

How do I change text on submitthe submission button in the node form?

I'm trying to change the submit button text "Save and keep published", but with no luck. I'm using the standard hook_form_FORM_ID_alter() like this:.

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpm() returns:.

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

Any helpHow do I change text on the submission button in the node form?

How do I change text on submit button in the node form?

I'm trying to change the submit button text "Save and keep published", but with no luck. I'm using standard hook_form_FORM_ID_alter like this:

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpm() returns:

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

Any help?

How do I change text on the submission button in the node form?

I'm trying to change the submit button text "Save and keep published", but with no luck. I'm using the standard hook_form_FORM_ID_alter().

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpm() returns.

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

How do I change text on the submission button in the node form?

I tryI'm trying to change the submit button text "Save and keep published", but with no luck. I'm using standard hook_form_FORM_ID_alterhook_form_FORM_ID_alter like this:

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpmdpm() returns:

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

Any help?

I try to change submit button text "Save and keep published", but with no luck. I'm using standard hook_form_FORM_ID_alter like this:

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpm returns:

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

Any help?

I'm trying to change the submit button text "Save and keep published", but with no luck. I'm using standard hook_form_FORM_ID_alter like this:

function mymodule_form_node_news_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  // This is the problem, what should I put here
  $form['actions']['publish']['#value'] == '';
}

This is what dpm() returns:

'publish' => array(7)
  '#value' => object Drupal\Core\StringTranslation\TranslatableMarkup(5)
    protected string -> string(18) "Save and keep published"
    protected translatedMarkup -> NULL
    protected options -> array(0)
    protected stringTranslation -> NULL
    protected arguments -> array(0)

Any help?

removed tags from title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

8- How todo I change text on submit button in the node form?

Source Link
David
  • 927
  • 3
  • 10
  • 25
Loading