Problem/Motivation

The published field will be created but, after will be needed add data

Proposed resolution

Create function to populate published field

Comments

thalles created an issue. See original summary.

thalles’s picture

Status: Needs work » Needs review
StatusFileSize
new906 bytes

Follow the patch!

renatog’s picture

Status: Needs review » Needs work

Very good, Thalles. Thanks

But we have an error here

if (empty(trim($modal->pages->value)) || empty(trim($modal->paramenters->value))) {

We need to check Modal Type, because if modal type == page so parameters will be empty (and if modal type == parameter so $modal->pages will be empty as well.

Following this logic aways one of them will be empty (or pages or parameters)

Please check this patch: #3098094: Create a hook update to update all modals for published = TRUE

E.g:

$modal->published = TRUE;

if ($modal->type->getString() == 'page' && empty($modal->pages->getString())) {
  $modal->published = FALSE;
}

$modal->save();
thalles’s picture

Follow a new patch!

thalles’s picture

Status: Needs work » Needs review
renatog’s picture

Status: Needs review » Reviewed & tested by the community

It really looks good.

  • thalles committed 21552aa on 8.x-2.x
    Issue #3099837 by thalles, RenatoG: Create function to populate...
thalles’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.