set_supported_post_types() public method

Sets post type support to the given post types.
Since: 3.0.0
public set_supported_post_types ( array $post_types ) : boolean
$post_types array Post type slugs.
return boolean Whether the support for all given post types was set successfully.
 /**
  * Updates the post type support settings.
  *
  * @since   3.0.0
  * @wp-hook mlp_modules_save_fields
  *
  * @return bool Whether or not the settings were updated successfully.
  */
 public function update_settings()
 {
     if (!$this->nonce->is_valid()) {
         return false;
     }
     $custom_post_types = $this->repository->get_custom_post_types();
     if (!$custom_post_types || empty($_POST[self::SETTINGS_NAME])) {
         return $this->repository->unsupport_all_post_types();
     }
     $custom_post_types = array_keys($custom_post_types);
     $settings = (array) $_POST[self::SETTINGS_NAME];
     $custom_post_types = array_combine($custom_post_types, array_map(function ($slug) use($settings) {
         if (empty($settings[$slug])) {
             return PostTypeRepository::CPT_INACTIVE;
         }
         return empty($settings["{$slug}|links"]) ? PostTypeRepository::CPT_ACTIVE : PostTypeRepository::CPT_QUERY_BASED;
     }, $custom_post_types));
     return $this->repository->set_supported_post_types($custom_post_types);
 }