original_string: public static function delete_customfields_data_for_context(string $component, string $area, \context $context) {
          global $DB;
  
          $sql = "SELECT d.id
              FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id
              JOIN {context} ctx ON ctx.id = d.contextid AND ctx.path LIKE :ctxpath
              WHERE c.component = :cfcomponent AND c.area = :cfarea";
          $params = self::get_params($component, $area, ['ctxpath' => $context->path . '%']);
  
          self::before_delete_data('IN (' . $sql . ') ', $params);
  
          $DB->execute("DELETE FROM {customfield_data}
              WHERE fieldid IN (SELECT f.id
                  FROM {customfield_category} c
                  JOIN {customfield_field} f ON f.categoryid = c.id
                  WHERE c.component = :cfcomponent AND c.area = :cfarea)
              AND contextid IN (SELECT id FROM {context} WHERE path LIKE :ctxpath)",
              $params);
      }
code: public static function delete_customfields_data_for_context(string $component, string $area, \context $context) {
          global $DB;
  
          $sql = "SELECT d.id
              FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id
              JOIN {context} ctx ON ctx.id = d.contextid AND ctx.path LIKE :ctxpath
              WHERE c.component = :cfcomponent AND c.area = :cfarea";
          $params = self::get_params($component, $area, ['ctxpath' => $context->path . '%']);
  
          self::before_delete_data('IN (' . $sql . ') ', $params);
  
          $DB->execute("DELETE FROM {customfield_data}
              WHERE fieldid IN (SELECT f.id
                  FROM {customfield_category} c
                  JOIN {customfield_field} f ON f.categoryid = c.id
                  WHERE c.component = :cfcomponent AND c.area = :cfarea)
              AND contextid IN (SELECT id FROM {context} WHERE path LIKE :ctxpath)",
              $params);
      }
code_tokens: public static function delete_customfields_data_for_context ( string $ component , string $ area , \ context $ context ) { global $ DB ; $ sql = "SELECT d.id
              FROM {customfield_category} c
              JOIN {customfield_field} f ON f.categoryid = c.id
              JOIN {customfield_data} d ON d.fieldid = f.id
              JOIN {context} ctx ON ctx.id = d.contextid AND ctx.path LIKE :ctxpath
              WHERE c.component = :cfcomponent AND c.area = :cfarea" ; $ params = self :: get_params ( $ component , $ area , [ 'ctxpath' => $ context -> path . '%' ] ) ; self :: before_delete_data ( 'IN (' . $ sql . ') ' , $ params ) ; $ DB -> execute ( "DELETE FROM {customfield_data}
              WHERE fieldid IN (SELECT f.id
                  FROM {customfield_category} c
                  JOIN {customfield_field} f ON f.categoryid = c.id
                  WHERE c.component = :cfcomponent AND c.area = :cfarea)
              AND contextid IN (SELECT id FROM {context} WHERE path LIKE :ctxpath)" , $ params ) ; }
docstring: Deletes all customfields data for the given context
  
  To be used in implementations of core_user_data_provider::delete_data_for_all_users_in_context
  
  @param string $component
  @param string $area
  @param \context $context
docstring_tokens: Deletes all customfields data for the given context