id = $id; $descriptor->label = isset( $fields['label'] ) ? (string) $fields['label'] : $id; $descriptor->group = isset( $fields['group'] ) ? (string) $fields['group'] : 'general'; $descriptor->scope = $scope; $descriptor->retention_kind = $kind; $descriptor->destructive = isset( $fields['destructive'] ) ? (bool) $fields['destructive'] : true; $descriptor->schedulable = isset( $fields['schedulable'] ) ? (bool) $fields['schedulable'] : true; return $descriptor; } /** * Whether this task touches the filesystem, and therefore whether an * unwritable uploads directory makes it unavailable. */ public function touches_files(): bool { return self::SCOPE_RECORDS !== $this->scope; } /** * @return array Wire shape consumed by the REST layer and the UI. */ public function to_array(): array { return [ 'id' => $this->id, 'label' => $this->label, 'group' => $this->group, 'scope' => $this->scope, 'retention_kind' => $this->retention_kind, 'destructive' => $this->destructive, 'schedulable' => $this->schedulable, ]; } }