This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How to avoid locking code implementing a custom field to specific names

I have created a custom module that creates a custom text field. The general idea is that site builders who install this module shall be able to use this custom field when creating a custom content type using the Drupal UI.

I have most of this working for me now, but it is not ready for others, for the following reasons:

Add a Form inside the table header.

How Can I add a Drupal 8 form inside the table header?

Validate form with multivalue field

I have a multivalue text plain field in a custom content type.

I have custom validation for this field that looks like this:

public function validate($element, FormStateInterface $form_state) {
  $value = $element['#value'];
  $validvalue = $this->isValid($value);
  if ($validvalue) {
    $form_state->setValue('field_myfield', [['value' => $validvalue]]);
  }
  else {
    $form_state->setError($element, $this->t('Not valid.');
  }
}

As long as the field only contains a single value, this works great.

Is there an alternative way to do this with dependecy injection?

I have a custom submit handler for a field in class that extends WidgetBase. I need to alter the value for a custom field.

I currently do it with this code line:

$form_state->setValue('field_myfield', [['value' => $value]]);

It works fine.

However, I understand that dependency injection should be used in OO code if possible.

Custom form

Hi, I have an array that I need to loop to update the nodes with the values ​​of a field from another node
This is the code
foreach ($ nNodiDispo as $ nidDispo) {

Automatic Node expiry email alerts

Hi

I administer a government website with close to 6000 assets - pages, documents, etc.

Is there a way that the system can automatically alert (email) these people and tell them to review their content?

Is this an out-of-the-box thing or is there a better add-on/module, et cetera.

What is the best way to ensure content stays up to date when you have a very large number of content owners?

Kind regards

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions